proteus  1.1.0
C/C++/Fortran libraries
subsurfaceTransportFunctions.c
Go to the documentation of this file.
1 /* Generated by Cython 0.23.4 */
2 
3 #define PY_SSIZE_T_CLEAN
4 #include "Python.h"
5 #ifndef Py_PYTHON_H
6  #error Python headers needed to compile C extensions, please install development version of Python.
7 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
8  #error Cython requires Python 2.6+ or Python 3.2+.
9 #else
10 #define CYTHON_ABI "0_23_4"
11 #include <stddef.h>
12 #ifndef offsetof
13 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
14 #endif
15 #if !defined(WIN32) && !defined(MS_WINDOWS)
16  #ifndef __stdcall
17  #define __stdcall
18  #endif
19  #ifndef __cdecl
20  #define __cdecl
21  #endif
22  #ifndef __fastcall
23  #define __fastcall
24  #endif
25 #endif
26 #ifndef DL_IMPORT
27  #define DL_IMPORT(t) t
28 #endif
29 #ifndef DL_EXPORT
30  #define DL_EXPORT(t) t
31 #endif
32 #ifndef PY_LONG_LONG
33  #define PY_LONG_LONG LONG_LONG
34 #endif
35 #ifndef Py_HUGE_VAL
36  #define Py_HUGE_VAL HUGE_VAL
37 #endif
38 #ifdef PYPY_VERSION
39 #define CYTHON_COMPILING_IN_PYPY 1
40 #define CYTHON_COMPILING_IN_CPYTHON 0
41 #else
42 #define CYTHON_COMPILING_IN_PYPY 0
43 #define CYTHON_COMPILING_IN_CPYTHON 1
44 #endif
45 #if !defined(CYTHON_USE_PYLONG_INTERNALS) && CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070000
46 #define CYTHON_USE_PYLONG_INTERNALS 1
47 #endif
48 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
49 #define Py_OptimizeFlag 0
50 #endif
51 #define __PYX_BUILD_PY_SSIZE_T "n"
52 #define CYTHON_FORMAT_SSIZE_T "z"
53 #if PY_MAJOR_VERSION < 3
54  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
55  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
56  PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
57  #define __Pyx_DefaultClassType PyClass_Type
58 #else
59  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
60  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
61  PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
62  #define __Pyx_DefaultClassType PyType_Type
63 #endif
64 #ifndef Py_TPFLAGS_CHECKTYPES
65  #define Py_TPFLAGS_CHECKTYPES 0
66 #endif
67 #ifndef Py_TPFLAGS_HAVE_INDEX
68  #define Py_TPFLAGS_HAVE_INDEX 0
69 #endif
70 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
71  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
72 #endif
73 #ifndef Py_TPFLAGS_HAVE_FINALIZE
74  #define Py_TPFLAGS_HAVE_FINALIZE 0
75 #endif
76 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
77  #define CYTHON_PEP393_ENABLED 1
78  #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
79  0 : _PyUnicode_Ready((PyObject *)(op)))
80  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
81  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
82  #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
83  #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
84  #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
85 #else
86  #define CYTHON_PEP393_ENABLED 0
87  #define __Pyx_PyUnicode_READY(op) (0)
88  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
89  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
90  #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
91  #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
92  #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
93 #endif
94 #if CYTHON_COMPILING_IN_PYPY
95  #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
96  #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
97 #else
98  #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
99  #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
100  PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
101 #endif
102 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
103  #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
104 #endif
105 #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
106 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
107 #if PY_MAJOR_VERSION >= 3
108  #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
109 #else
110  #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
111 #endif
112 #if PY_MAJOR_VERSION >= 3
113  #define PyBaseString_Type PyUnicode_Type
114  #define PyStringObject PyUnicodeObject
115  #define PyString_Type PyUnicode_Type
116  #define PyString_Check PyUnicode_Check
117  #define PyString_CheckExact PyUnicode_CheckExact
118 #endif
119 #if PY_MAJOR_VERSION >= 3
120  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
121  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
122 #else
123  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
124  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
125 #endif
126 #ifndef PySet_CheckExact
127  #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
128 #endif
129 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
130 #if PY_MAJOR_VERSION >= 3
131  #define PyIntObject PyLongObject
132  #define PyInt_Type PyLong_Type
133  #define PyInt_Check(op) PyLong_Check(op)
134  #define PyInt_CheckExact(op) PyLong_CheckExact(op)
135  #define PyInt_FromString PyLong_FromString
136  #define PyInt_FromUnicode PyLong_FromUnicode
137  #define PyInt_FromLong PyLong_FromLong
138  #define PyInt_FromSize_t PyLong_FromSize_t
139  #define PyInt_FromSsize_t PyLong_FromSsize_t
140  #define PyInt_AsLong PyLong_AsLong
141  #define PyInt_AS_LONG PyLong_AS_LONG
142  #define PyInt_AsSsize_t PyLong_AsSsize_t
143  #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
144  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
145  #define PyNumber_Int PyNumber_Long
146 #endif
147 #if PY_MAJOR_VERSION >= 3
148  #define PyBoolObject PyLongObject
149 #endif
150 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
151  #ifndef PyUnicode_InternFromString
152  #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
153  #endif
154 #endif
155 #if PY_VERSION_HEX < 0x030200A4
156  typedef long Py_hash_t;
157  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
158  #define __Pyx_PyInt_AsHash_t PyInt_AsLong
159 #else
160  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
161  #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
162 #endif
163 #if PY_MAJOR_VERSION >= 3
164  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
165 #else
166  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
167 #endif
168 #if PY_VERSION_HEX >= 0x030500B1
169 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
170 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
171 #elif CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
172 typedef struct {
173  unaryfunc am_await;
174  unaryfunc am_aiter;
175  unaryfunc am_anext;
176 } __Pyx_PyAsyncMethodsStruct;
177 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
178 #else
179 #define __Pyx_PyType_AsAsync(obj) NULL
180 #endif
181 #ifndef CYTHON_RESTRICT
182  #if defined(__GNUC__)
183  #define CYTHON_RESTRICT __restrict__
184  #elif defined(_MSC_VER) && _MSC_VER >= 1400
185  #define CYTHON_RESTRICT __restrict
186  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
187  #define CYTHON_RESTRICT restrict
188  #else
189  #define CYTHON_RESTRICT
190  #endif
191 #endif
192 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
193 
194 #ifndef CYTHON_INLINE
195  #if defined(__GNUC__)
196  #define CYTHON_INLINE __inline__
197  #elif defined(_MSC_VER)
198  #define CYTHON_INLINE __inline
199  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
200  #define CYTHON_INLINE inline
201  #else
202  #define CYTHON_INLINE
203  #endif
204 #endif
205 
206 #if defined(WIN32) || defined(MS_WINDOWS)
207  #define _USE_MATH_DEFINES
208 #endif
209 #include <math.h>
210 #ifdef NAN
211 #define __PYX_NAN() ((float) NAN)
212 #else
213 static CYTHON_INLINE float __PYX_NAN() {
214  float value;
215  memset(&value, 0xFF, sizeof(value));
216  return value;
217 }
218 #endif
219 
220 
221 #if PY_MAJOR_VERSION >= 3
222  #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
223  #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
224 #else
225  #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
226  #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
227 #endif
228 
229 #ifndef __PYX_EXTERN_C
230  #ifdef __cplusplus
231  #define __PYX_EXTERN_C extern "C"
232  #else
233  #define __PYX_EXTERN_C extern
234  #endif
235 #endif
236 
237 #define __PYX_HAVE__subsurfaceTransportFunctions
238 #define __PYX_HAVE_API__subsurfaceTransportFunctions
239 #include "string.h"
240 #include "stdio.h"
241 #include "stdlib.h"
242 #include "numpy/arrayobject.h"
243 #include "numpy/ufuncobject.h"
244 #include "math.h"
245 #ifdef _OPENMP
246 #include <omp.h>
247 #endif /* _OPENMP */
248 
249 #ifdef PYREX_WITHOUT_ASSERTIONS
250 #define CYTHON_WITHOUT_ASSERTIONS
251 #endif
252 
253 #ifndef CYTHON_UNUSED
254 # if defined(__GNUC__)
255 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
256 # define CYTHON_UNUSED __attribute__ ((__unused__))
257 # else
258 # define CYTHON_UNUSED
259 # endif
260 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
261 # define CYTHON_UNUSED __attribute__ ((__unused__))
262 # else
263 # define CYTHON_UNUSED
264 # endif
265 #endif
266 #ifndef CYTHON_NCP_UNUSED
267 # if CYTHON_COMPILING_IN_CPYTHON
268 # define CYTHON_NCP_UNUSED
269 # else
270 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
271 # endif
272 #endif
273 typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
274  const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
275 
276 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
277 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
278 #define __PYX_DEFAULT_STRING_ENCODING ""
279 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
280 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
281 #define __Pyx_uchar_cast(c) ((unsigned char)c)
282 #define __Pyx_long_cast(x) ((long)x)
283 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
284  (sizeof(type) < sizeof(Py_ssize_t)) ||\
285  (sizeof(type) > sizeof(Py_ssize_t) &&\
286  likely(v < (type)PY_SSIZE_T_MAX ||\
287  v == (type)PY_SSIZE_T_MAX) &&\
288  (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
289  v == (type)PY_SSIZE_T_MIN))) ||\
290  (sizeof(type) == sizeof(Py_ssize_t) &&\
291  (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
292  v == (type)PY_SSIZE_T_MAX))) )
293 #if defined (__cplusplus) && __cplusplus >= 201103L
294  #include <cstdlib>
295  #define __Pyx_sst_abs(value) std::abs(value)
296 #elif SIZEOF_INT >= SIZEOF_SIZE_T
297  #define __Pyx_sst_abs(value) abs(value)
298 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
299  #define __Pyx_sst_abs(value) labs(value)
300 #elif defined (_MSC_VER) && defined (_M_X64)
301  #define __Pyx_sst_abs(value) _abs64(value)
302 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
303  #define __Pyx_sst_abs(value) llabs(value)
304 #elif defined (__GNUC__)
305  #define __Pyx_sst_abs(value) __builtin_llabs(value)
306 #else
307  #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
308 #endif
309 static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
310 static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
311 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
312 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
313 #define __Pyx_PyBytes_FromString PyBytes_FromString
314 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
315 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
316 #if PY_MAJOR_VERSION < 3
317  #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
318  #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
319 #else
320  #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
321  #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
322 #endif
323 #define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
324 #define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
325 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
326 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
327 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
328 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
329 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
330 #if PY_MAJOR_VERSION < 3
331 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
332 {
333  const Py_UNICODE *u_end = u;
334  while (*u_end++) ;
335  return (size_t)(u_end - u - 1);
336 }
337 #else
338 #define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
339 #endif
340 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
341 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
342 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
343 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
344 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
345 #define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False))
346 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
347 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
348 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
349 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
350 #if CYTHON_COMPILING_IN_CPYTHON
351 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
352 #else
353 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
354 #endif
355 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
356 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
357 static int __Pyx_sys_getdefaultencoding_not_ascii;
358 static int __Pyx_init_sys_getdefaultencoding_params(void) {
359  PyObject* sys;
360  PyObject* default_encoding = NULL;
361  PyObject* ascii_chars_u = NULL;
362  PyObject* ascii_chars_b = NULL;
363  const char* default_encoding_c;
364  sys = PyImport_ImportModule("sys");
365  if (!sys) goto bad;
366  default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
367  Py_DECREF(sys);
368  if (!default_encoding) goto bad;
369  default_encoding_c = PyBytes_AsString(default_encoding);
370  if (!default_encoding_c) goto bad;
371  if (strcmp(default_encoding_c, "ascii") == 0) {
372  __Pyx_sys_getdefaultencoding_not_ascii = 0;
373  } else {
374  char ascii_chars[128];
375  int c;
376  for (c = 0; c < 128; c++) {
377  ascii_chars[c] = c;
378  }
379  __Pyx_sys_getdefaultencoding_not_ascii = 1;
380  ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
381  if (!ascii_chars_u) goto bad;
382  ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
383  if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
384  PyErr_Format(
385  PyExc_ValueError,
386  "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
387  default_encoding_c);
388  goto bad;
389  }
390  Py_DECREF(ascii_chars_u);
391  Py_DECREF(ascii_chars_b);
392  }
393  Py_DECREF(default_encoding);
394  return 0;
395 bad:
396  Py_XDECREF(default_encoding);
397  Py_XDECREF(ascii_chars_u);
398  Py_XDECREF(ascii_chars_b);
399  return -1;
400 }
401 #endif
402 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
403 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
404 #else
405 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
406 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
407 static char* __PYX_DEFAULT_STRING_ENCODING;
408 static int __Pyx_init_sys_getdefaultencoding_params(void) {
409  PyObject* sys;
410  PyObject* default_encoding = NULL;
411  char* default_encoding_c;
412  sys = PyImport_ImportModule("sys");
413  if (!sys) goto bad;
414  default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
415  Py_DECREF(sys);
416  if (!default_encoding) goto bad;
417  default_encoding_c = PyBytes_AsString(default_encoding);
418  if (!default_encoding_c) goto bad;
419  __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
420  if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
421  strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
422  Py_DECREF(default_encoding);
423  return 0;
424 bad:
425  Py_XDECREF(default_encoding);
426  return -1;
427 }
428 #endif
429 #endif
430 
431 
432 /* Test for GCC > 2.95 */
433 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
434  #define likely(x) __builtin_expect(!!(x), 1)
435  #define unlikely(x) __builtin_expect(!!(x), 0)
436 #else /* !__GNUC__ or GCC < 2.95 */
437  #define likely(x) (x)
438  #define unlikely(x) (x)
439 #endif /* __GNUC__ */
440 
441 static PyObject *__pyx_m;
442 static PyObject *__pyx_d;
443 static PyObject *__pyx_b;
444 static PyObject *__pyx_empty_tuple;
445 static PyObject *__pyx_empty_bytes;
446 static int __pyx_lineno;
447 static int __pyx_clineno = 0;
448 static const char * __pyx_cfilenm= __FILE__;
449 static const char *__pyx_filename;
450 
451 #if !defined(CYTHON_CCOMPLEX)
452  #if defined(__cplusplus)
453  #define CYTHON_CCOMPLEX 1
454  #elif defined(_Complex_I)
455  #define CYTHON_CCOMPLEX 1
456  #else
457  #define CYTHON_CCOMPLEX 0
458  #endif
459 #endif
460 #if CYTHON_CCOMPLEX
461  #ifdef __cplusplus
462  #include <complex>
463  #else
464  #include <complex.h>
465  #endif
466 #endif
467 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
468  #undef _Complex_I
469  #define _Complex_I 1.0fj
470 #endif
471 
472 
473 static const char *__pyx_f[] = {
474  "proteus/subsurfaceTransportFunctions.pyx",
475  "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd",
476  "linux2/lib/python2.7/site-packages/Cython/Includes/cpython/type.pxd",
477 };
478 #define IS_UNSIGNED(type) (((type) -1) > 0)
479 struct __Pyx_StructField_;
480 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
481 typedef struct {
482  const char* name;
483  struct __Pyx_StructField_* fields;
484  size_t size;
485  size_t arraysize[8];
486  int ndim;
487  char typegroup;
488  char is_unsigned;
489  int flags;
490 } __Pyx_TypeInfo;
491 typedef struct __Pyx_StructField_ {
492  __Pyx_TypeInfo* type;
493  const char* name;
494  size_t offset;
495 } __Pyx_StructField;
496 typedef struct {
497  __Pyx_StructField* field;
498  size_t parent_offset;
499 } __Pyx_BufFmt_StackElem;
500 typedef struct {
501  __Pyx_StructField root;
502  __Pyx_BufFmt_StackElem* head;
503  size_t fmt_offset;
504  size_t new_count, enc_count;
505  size_t struct_alignment;
506  int is_complex;
507  char enc_type;
508  char new_packmode;
509  char enc_packmode;
510  char is_valid_array;
511 } __Pyx_BufFmt_Context;
512 
513 
514 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":725
515  * # in Cython to enable them only on the right systems.
516  *
517  * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<<
518  * ctypedef npy_int16 int16_t
519  * ctypedef npy_int32 int32_t
520  */
521 typedef npy_int8 __pyx_t_5numpy_int8_t;
522 
523 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":726
524  *
525  * ctypedef npy_int8 int8_t
526  * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<<
527  * ctypedef npy_int32 int32_t
528  * ctypedef npy_int64 int64_t
529  */
530 typedef npy_int16 __pyx_t_5numpy_int16_t;
531 
532 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":727
533  * ctypedef npy_int8 int8_t
534  * ctypedef npy_int16 int16_t
535  * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<<
536  * ctypedef npy_int64 int64_t
537  * #ctypedef npy_int96 int96_t
538  */
539 typedef npy_int32 __pyx_t_5numpy_int32_t;
540 
541 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":728
542  * ctypedef npy_int16 int16_t
543  * ctypedef npy_int32 int32_t
544  * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<<
545  * #ctypedef npy_int96 int96_t
546  * #ctypedef npy_int128 int128_t
547  */
548 typedef npy_int64 __pyx_t_5numpy_int64_t;
549 
550 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":732
551  * #ctypedef npy_int128 int128_t
552  *
553  * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<<
554  * ctypedef npy_uint16 uint16_t
555  * ctypedef npy_uint32 uint32_t
556  */
557 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
558 
559 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":733
560  *
561  * ctypedef npy_uint8 uint8_t
562  * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<<
563  * ctypedef npy_uint32 uint32_t
564  * ctypedef npy_uint64 uint64_t
565  */
566 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
567 
568 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":734
569  * ctypedef npy_uint8 uint8_t
570  * ctypedef npy_uint16 uint16_t
571  * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<<
572  * ctypedef npy_uint64 uint64_t
573  * #ctypedef npy_uint96 uint96_t
574  */
575 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
576 
577 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":735
578  * ctypedef npy_uint16 uint16_t
579  * ctypedef npy_uint32 uint32_t
580  * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<<
581  * #ctypedef npy_uint96 uint96_t
582  * #ctypedef npy_uint128 uint128_t
583  */
584 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
585 
586 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":739
587  * #ctypedef npy_uint128 uint128_t
588  *
589  * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<<
590  * ctypedef npy_float64 float64_t
591  * #ctypedef npy_float80 float80_t
592  */
593 typedef npy_float32 __pyx_t_5numpy_float32_t;
594 
595 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":740
596  *
597  * ctypedef npy_float32 float32_t
598  * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<<
599  * #ctypedef npy_float80 float80_t
600  * #ctypedef npy_float128 float128_t
601  */
602 typedef npy_float64 __pyx_t_5numpy_float64_t;
603 
604 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":749
605  * # The int types are mapped a bit surprising --
606  * # numpy.int corresponds to 'l' and numpy.long to 'q'
607  * ctypedef npy_long int_t # <<<<<<<<<<<<<<
608  * ctypedef npy_longlong long_t
609  * ctypedef npy_longlong longlong_t
610  */
611 typedef npy_long __pyx_t_5numpy_int_t;
612 
613 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":750
614  * # numpy.int corresponds to 'l' and numpy.long to 'q'
615  * ctypedef npy_long int_t
616  * ctypedef npy_longlong long_t # <<<<<<<<<<<<<<
617  * ctypedef npy_longlong longlong_t
618  *
619  */
620 typedef npy_longlong __pyx_t_5numpy_long_t;
621 
622 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":751
623  * ctypedef npy_long int_t
624  * ctypedef npy_longlong long_t
625  * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<<
626  *
627  * ctypedef npy_ulong uint_t
628  */
629 typedef npy_longlong __pyx_t_5numpy_longlong_t;
630 
631 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":753
632  * ctypedef npy_longlong longlong_t
633  *
634  * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<<
635  * ctypedef npy_ulonglong ulong_t
636  * ctypedef npy_ulonglong ulonglong_t
637  */
638 typedef npy_ulong __pyx_t_5numpy_uint_t;
639 
640 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":754
641  *
642  * ctypedef npy_ulong uint_t
643  * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<<
644  * ctypedef npy_ulonglong ulonglong_t
645  *
646  */
647 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
648 
649 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":755
650  * ctypedef npy_ulong uint_t
651  * ctypedef npy_ulonglong ulong_t
652  * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<<
653  *
654  * ctypedef npy_intp intp_t
655  */
656 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
657 
658 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":757
659  * ctypedef npy_ulonglong ulonglong_t
660  *
661  * ctypedef npy_intp intp_t # <<<<<<<<<<<<<<
662  * ctypedef npy_uintp uintp_t
663  *
664  */
665 typedef npy_intp __pyx_t_5numpy_intp_t;
666 
667 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":758
668  *
669  * ctypedef npy_intp intp_t
670  * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<<
671  *
672  * ctypedef npy_double float_t
673  */
674 typedef npy_uintp __pyx_t_5numpy_uintp_t;
675 
676 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":760
677  * ctypedef npy_uintp uintp_t
678  *
679  * ctypedef npy_double float_t # <<<<<<<<<<<<<<
680  * ctypedef npy_double double_t
681  * ctypedef npy_longdouble longdouble_t
682  */
683 typedef npy_double __pyx_t_5numpy_float_t;
684 
685 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":761
686  *
687  * ctypedef npy_double float_t
688  * ctypedef npy_double double_t # <<<<<<<<<<<<<<
689  * ctypedef npy_longdouble longdouble_t
690  *
691  */
692 typedef npy_double __pyx_t_5numpy_double_t;
693 
694 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":762
695  * ctypedef npy_double float_t
696  * ctypedef npy_double double_t
697  * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<<
698  *
699  * ctypedef npy_cfloat cfloat_t
700  */
701 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
702 
703 /* "subsurfaceTransportFunctions.pyx":14
704  * cdef inline double double_min(double a, double b): return a if a <= b else b
705  *
706  * ctypedef numpy.double_t DTYPE_t # <<<<<<<<<<<<<<
707  * #numpy.intc_t not in cython's numpy.pxd
708  * ctypedef int ITYPE_t
709  */
710 typedef __pyx_t_5numpy_double_t __pyx_t_28subsurfaceTransportFunctions_DTYPE_t;
711 
712 /* "subsurfaceTransportFunctions.pyx":16
713  * ctypedef numpy.double_t DTYPE_t
714  * #numpy.intc_t not in cython's numpy.pxd
715  * ctypedef int ITYPE_t # <<<<<<<<<<<<<<
716  *
717  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global,
718  */
719 typedef int __pyx_t_28subsurfaceTransportFunctions_ITYPE_t;
720 #if CYTHON_CCOMPLEX
721  #ifdef __cplusplus
722  typedef ::std::complex< float > __pyx_t_float_complex;
723  #else
724  typedef float _Complex __pyx_t_float_complex;
725  #endif
726 #else
727  typedef struct { float real, imag; } __pyx_t_float_complex;
728 #endif
729 
730 #if CYTHON_CCOMPLEX
731  #ifdef __cplusplus
732  typedef ::std::complex< double > __pyx_t_double_complex;
733  #else
734  typedef double _Complex __pyx_t_double_complex;
735  #endif
736 #else
737  typedef struct { double real, imag; } __pyx_t_double_complex;
738 #endif
739 
740 
741 /*--- Type declarations ---*/
742 
743 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":764
744  * ctypedef npy_longdouble longdouble_t
745  *
746  * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<<
747  * ctypedef npy_cdouble cdouble_t
748  * ctypedef npy_clongdouble clongdouble_t
749  */
750 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
751 
752 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":765
753  *
754  * ctypedef npy_cfloat cfloat_t
755  * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<<
756  * ctypedef npy_clongdouble clongdouble_t
757  *
758  */
759 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
760 
761 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":766
762  * ctypedef npy_cfloat cfloat_t
763  * ctypedef npy_cdouble cdouble_t
764  * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<<
765  *
766  * ctypedef npy_cdouble complex_t
767  */
768 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
769 
770 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":768
771  * ctypedef npy_clongdouble clongdouble_t
772  *
773  * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<<
774  *
775  * cdef inline object PyArray_MultiIterNew1(a):
776  */
777 typedef npy_cdouble __pyx_t_5numpy_complex_t;
778 
779 /* --- Runtime support code (head) --- */
780 #ifndef CYTHON_REFNANNY
781  #define CYTHON_REFNANNY 0
782 #endif
783 #if CYTHON_REFNANNY
784  typedef struct {
785  void (*INCREF)(void*, PyObject*, int);
786  void (*DECREF)(void*, PyObject*, int);
787  void (*GOTREF)(void*, PyObject*, int);
788  void (*GIVEREF)(void*, PyObject*, int);
789  void* (*SetupContext)(const char*, int, const char*);
790  void (*FinishContext)(void**);
791  } __Pyx_RefNannyAPIStruct;
792  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
793  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
794  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
795 #ifdef WITH_THREAD
796  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
797  if (acquire_gil) {\
798  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
799  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
800  PyGILState_Release(__pyx_gilstate_save);\
801  } else {\
802  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
803  }
804 #else
805  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
806  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
807 #endif
808  #define __Pyx_RefNannyFinishContext()\
809  __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
810  #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
811  #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
812  #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
813  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
814  #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
815  #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
816  #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
817  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
818 #else
819  #define __Pyx_RefNannyDeclarations
820  #define __Pyx_RefNannySetupContext(name, acquire_gil)
821  #define __Pyx_RefNannyFinishContext()
822  #define __Pyx_INCREF(r) Py_INCREF(r)
823  #define __Pyx_DECREF(r) Py_DECREF(r)
824  #define __Pyx_GOTREF(r)
825  #define __Pyx_GIVEREF(r)
826  #define __Pyx_XINCREF(r) Py_XINCREF(r)
827  #define __Pyx_XDECREF(r) Py_XDECREF(r)
828  #define __Pyx_XGOTREF(r)
829  #define __Pyx_XGIVEREF(r)
830 #endif
831 #define __Pyx_XDECREF_SET(r, v) do {\
832  PyObject *tmp = (PyObject *) r;\
833  r = v; __Pyx_XDECREF(tmp);\
834  } while (0)
835 #define __Pyx_DECREF_SET(r, v) do {\
836  PyObject *tmp = (PyObject *) r;\
837  r = v; __Pyx_DECREF(tmp);\
838  } while (0)
839 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
840 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
841 
842 #if CYTHON_COMPILING_IN_CPYTHON
843 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
844  PyTypeObject* tp = Py_TYPE(obj);
845  if (likely(tp->tp_getattro))
846  return tp->tp_getattro(obj, attr_name);
847 #if PY_MAJOR_VERSION < 3
848  if (likely(tp->tp_getattr))
849  return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
850 #endif
851  return PyObject_GetAttr(obj, attr_name);
852 }
853 #else
854 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
855 #endif
856 
857 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
858 
859 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
860  Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
861 
862 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
863 
864 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
865  PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
866  const char* function_name);
867 
868 static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
869  const char *name, int exact);
870 
871 static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
872  __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
873 static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
874 
875 static void __Pyx_RaiseBufferIndexError(int axis);
876 
877 #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
878 #define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1)
879 static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb);
880 static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb);
881 
882 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
883 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
884  PyObject *value;
885  value = PyDict_GetItemWithError(d, key);
886  if (unlikely(!value)) {
887  if (!PyErr_Occurred()) {
888  PyObject* args = PyTuple_Pack(1, key);
889  if (likely(args))
890  PyErr_SetObject(PyExc_KeyError, args);
891  Py_XDECREF(args);
892  }
893  return NULL;
894  }
895  Py_INCREF(value);
896  return value;
897 }
898 #else
899  #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
900 #endif
901 
902 #define __Pyx_BufPtrStrided3d(type, buf, i0, s0, i1, s1, i2, s2) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2)
903 #if CYTHON_COMPILING_IN_CPYTHON
904 static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floatval, int inplace);
905 #else
906 #define __Pyx_PyFloat_AddObjC(op1, op2, floatval, inplace)\
907  (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
908 #endif
909 
910 #define __Pyx_BufPtrStrided4d(type, buf, i0, s0, i1, s1, i2, s2, i3, s3) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2 + i3 * s3)
911 #if CYTHON_COMPILING_IN_CPYTHON
912 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
913 #else
914 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
915 #endif
916 
917 static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
918 
919 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
920 
921 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
922  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
923  __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
924  (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
925  __Pyx_GetItemInt_Generic(o, to_py_func(i))))
926 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
927  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
928  __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
929  (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
930 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
931  int wraparound, int boundscheck);
932 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
933  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
934  __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
935  (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
936 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
937  int wraparound, int boundscheck);
938 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
939 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
940  int is_list, int wraparound, int boundscheck);
941 
942 #if CYTHON_COMPILING_IN_CPYTHON
943 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
944 #endif
945 
946 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
947 
948 static double __Pyx__PyObject_AsDouble(PyObject* obj);
949 #if CYTHON_COMPILING_IN_PYPY
950 #define __Pyx_PyObject_AsDouble(obj)\
951 (likely(PyFloat_CheckExact(obj)) ? PyFloat_AS_DOUBLE(obj) :\
952  likely(PyInt_CheckExact(obj)) ?\
953  PyFloat_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj))
954 #else
955 #define __Pyx_PyObject_AsDouble(obj)\
956 ((likely(PyFloat_CheckExact(obj))) ?\
957  PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj))
958 #endif
959 
960 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
961 
962 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
963 
964 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
965 
966 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
967 
968 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
969 
970 typedef struct {
971  int code_line;
972  PyCodeObject* code_object;
973 } __Pyx_CodeObjectCacheEntry;
974 struct __Pyx_CodeObjectCache {
975  int count;
976  int max_count;
977  __Pyx_CodeObjectCacheEntry* entries;
978 };
979 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
980 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
981 static PyCodeObject *__pyx_find_code_object(int code_line);
982 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
983 
984 static void __Pyx_AddTraceback(const char *funcname, int c_line,
985  int py_line, const char *filename);
986 
987 typedef struct {
988  Py_ssize_t shape, strides, suboffsets;
989 } __Pyx_Buf_DimInfo;
990 typedef struct {
991  size_t refcount;
992  Py_buffer pybuffer;
993 } __Pyx_Buffer;
994 typedef struct {
995  __Pyx_Buffer *rcbuffer;
996  char *data;
997  __Pyx_Buf_DimInfo diminfo[8];
998 } __Pyx_LocalBuf_ND;
999 
1000 #if PY_MAJOR_VERSION < 3
1001  static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
1002  static void __Pyx_ReleaseBuffer(Py_buffer *view);
1003 #else
1004  #define __Pyx_GetBuffer PyObject_GetBuffer
1005  #define __Pyx_ReleaseBuffer PyBuffer_Release
1006 #endif
1007 
1008 
1009 static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0};
1010 static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1};
1011 
1012 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1013 
1014 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
1015 
1016 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value);
1017 
1018 static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_As_Py_intptr_t(PyObject *);
1019 
1020 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1021 
1022 #if CYTHON_CCOMPLEX
1023  #ifdef __cplusplus
1024  #define __Pyx_CREAL(z) ((z).real())
1025  #define __Pyx_CIMAG(z) ((z).imag())
1026  #else
1027  #define __Pyx_CREAL(z) (__real__(z))
1028  #define __Pyx_CIMAG(z) (__imag__(z))
1029  #endif
1030 #else
1031  #define __Pyx_CREAL(z) ((z).real)
1032  #define __Pyx_CIMAG(z) ((z).imag)
1033 #endif
1034 #if (defined(_WIN32) || defined(__clang__)) && defined(__cplusplus) && CYTHON_CCOMPLEX
1035  #define __Pyx_SET_CREAL(z,x) ((z).real(x))
1036  #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
1037 #else
1038  #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
1039  #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
1040 #endif
1041 
1042 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
1043 
1044 #if CYTHON_CCOMPLEX
1045  #define __Pyx_c_eqf(a, b) ((a)==(b))
1046  #define __Pyx_c_sumf(a, b) ((a)+(b))
1047  #define __Pyx_c_difff(a, b) ((a)-(b))
1048  #define __Pyx_c_prodf(a, b) ((a)*(b))
1049  #define __Pyx_c_quotf(a, b) ((a)/(b))
1050  #define __Pyx_c_negf(a) (-(a))
1051  #ifdef __cplusplus
1052  #define __Pyx_c_is_zerof(z) ((z)==(float)0)
1053  #define __Pyx_c_conjf(z) (::std::conj(z))
1054  #if 1
1055  #define __Pyx_c_absf(z) (::std::abs(z))
1056  #define __Pyx_c_powf(a, b) (::std::pow(a, b))
1057  #endif
1058  #else
1059  #define __Pyx_c_is_zerof(z) ((z)==0)
1060  #define __Pyx_c_conjf(z) (conjf(z))
1061  #if 1
1062  #define __Pyx_c_absf(z) (cabsf(z))
1063  #define __Pyx_c_powf(a, b) (cpowf(a, b))
1064  #endif
1065  #endif
1066 #else
1067  static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex);
1068  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex);
1069  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex);
1070  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex);
1071  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex);
1072  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex);
1073  static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex);
1074  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex);
1075  #if 1
1076  static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);
1077  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex);
1078  #endif
1079 #endif
1080 
1081 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
1082 
1083 #if CYTHON_CCOMPLEX
1084  #define __Pyx_c_eq(a, b) ((a)==(b))
1085  #define __Pyx_c_sum(a, b) ((a)+(b))
1086  #define __Pyx_c_diff(a, b) ((a)-(b))
1087  #define __Pyx_c_prod(a, b) ((a)*(b))
1088  #define __Pyx_c_quot(a, b) ((a)/(b))
1089  #define __Pyx_c_neg(a) (-(a))
1090  #ifdef __cplusplus
1091  #define __Pyx_c_is_zero(z) ((z)==(double)0)
1092  #define __Pyx_c_conj(z) (::std::conj(z))
1093  #if 1
1094  #define __Pyx_c_abs(z) (::std::abs(z))
1095  #define __Pyx_c_pow(a, b) (::std::pow(a, b))
1096  #endif
1097  #else
1098  #define __Pyx_c_is_zero(z) ((z)==0)
1099  #define __Pyx_c_conj(z) (conj(z))
1100  #if 1
1101  #define __Pyx_c_abs(z) (cabs(z))
1102  #define __Pyx_c_pow(a, b) (cpow(a, b))
1103  #endif
1104  #endif
1105 #else
1106  static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex);
1107  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex);
1108  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex);
1109  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex);
1110  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex);
1111  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex);
1112  static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex);
1113  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex);
1114  #if 1
1115  static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);
1116  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex);
1117  #endif
1118 #endif
1119 
1120 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);
1121 
1122 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1123 
1124 static int __Pyx_check_binary_version(void);
1125 
1126 #if !defined(__Pyx_PyIdentifier_FromString)
1127 #if PY_MAJOR_VERSION < 3
1128  #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
1129 #else
1130  #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
1131 #endif
1132 #endif
1133 
1134 static PyObject *__Pyx_ImportModule(const char *name);
1135 
1136 static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);
1137 
1138 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1139 
1140 
1141 /* Module declarations from 'cpython.buffer' */
1142 
1143 /* Module declarations from 'libc.string' */
1144 
1145 /* Module declarations from 'libc.stdio' */
1146 
1147 /* Module declarations from '__builtin__' */
1148 
1149 /* Module declarations from 'cpython.type' */
1150 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
1151 
1152 /* Module declarations from 'cpython' */
1153 
1154 /* Module declarations from 'cpython.object' */
1155 
1156 /* Module declarations from 'cpython.ref' */
1157 
1158 /* Module declarations from 'libc.stdlib' */
1159 
1160 /* Module declarations from 'numpy' */
1161 
1162 /* Module declarations from 'numpy' */
1163 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
1164 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
1165 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
1166 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
1167 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
1168 static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
1169 
1170 /* Module declarations from 'subsurfaceTransportFunctions' */
1171 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t = { "ITYPE_t", NULL, sizeof(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t), 0 };
1172 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t = { "DTYPE_t", NULL, sizeof(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t), { 0 }, 0, 'R', 0, 0 };
1173 #define __Pyx_MODULE_NAME "subsurfaceTransportFunctions"
1174 int __pyx_module_is_main_subsurfaceTransportFunctions = 0;
1175 
1176 /* Implementation of 'subsurfaceTransportFunctions' */
1177 static PyObject *__pyx_builtin_range;
1178 static PyObject *__pyx_builtin_ValueError;
1179 static PyObject *__pyx_builtin_RuntimeError;
1180 static char __pyx_k_B[] = "B";
1181 static char __pyx_k_H[] = "H";
1182 static char __pyx_k_I[] = "I";
1183 static char __pyx_k_J[] = "J";
1184 static char __pyx_k_L[] = "L";
1185 static char __pyx_k_O[] = "O";
1186 static char __pyx_k_Q[] = "Q";
1187 static char __pyx_k_b[] = "b";
1188 static char __pyx_k_d[] = "d";
1189 static char __pyx_k_f[] = "f";
1190 static char __pyx_k_g[] = "g";
1191 static char __pyx_k_h[] = "h";
1192 static char __pyx_k_i[] = "i";
1193 static char __pyx_k_j[] = "j";
1194 static char __pyx_k_k[] = "k";
1195 static char __pyx_k_l[] = "l";
1196 static char __pyx_k_m[] = "m";
1197 static char __pyx_k_n[] = "n";
1198 static char __pyx_k_q[] = "q";
1199 static char __pyx_k_t[] = "t";
1200 static char __pyx_k_v[] = "v";
1201 static char __pyx_k_w[] = "w";
1202 static char __pyx_k_x[] = "x";
1203 static char __pyx_k_Zd[] = "Zd";
1204 static char __pyx_k_Zf[] = "Zf";
1205 static char __pyx_k_Zg[] = "Zg";
1206 static char __pyx_k_dS[] = "dS";
1207 static char __pyx_k_dV[] = "dV";
1208 static char __pyx_k_df[] = "df";
1209 static char __pyx_k_dm[] = "dm";
1210 static char __pyx_k_eN[] = "eN";
1211 static char __pyx_k_ii[] = "ii";
1212 static char __pyx_k_kb[] = "kb";
1213 static char __pyx_k_mt[] = "mt";
1214 static char __pyx_k_nd[] = "nd";
1215 static char __pyx_k_pi[] = "pi";
1216 static char __pyx_k_xc[] = "xc";
1217 static char __pyx_k_yc[] = "yc";
1218 static char __pyx_k_KWr[] = "KWr";
1219 static char __pyx_k_KWs[] = "KWs";
1220 static char __pyx_k_dmt[] = "dmt";
1221 static char __pyx_k_dot[] = "dot";
1222 static char __pyx_k_ebN[] = "ebN";
1223 static char __pyx_k_l2g[] = "l2g";
1224 static char __pyx_k_nnz[] = "nnz";
1225 static char __pyx_k_q_m[] = "q_m";
1226 static char __pyx_k_q_r[] = "q_r";
1227 static char __pyx_k_q_u[] = "q_u";
1228 static char __pyx_k_q_x[] = "q_x";
1229 static char __pyx_k_rho[] = "rho";
1230 static char __pyx_k_sum[] = "sum";
1231 static char __pyx_k_u_j[] = "u_j";
1232 static char __pyx_k_vol[] = "vol";
1233 static char __pyx_k_a_eN[] = "a_eN";
1234 static char __pyx_k_a_up[] = "a_up";
1235 static char __pyx_k_beta[] = "beta";
1236 static char __pyx_k_ebNE[] = "ebNE";
1237 static char __pyx_k_f_up[] = "f_up";
1238 static char __pyx_k_flat[] = "flat";
1239 static char __pyx_k_flux[] = "flux";
1240 static char __pyx_k_main[] = "__main__";
1241 static char __pyx_k_one8[] = "one8";
1242 static char __pyx_k_psiC[] = "psiC";
1243 static char __pyx_k_q_dm[] = "q_dm";
1244 static char __pyx_k_q_kr[] = "q_kr";
1245 static char __pyx_k_q_mt[] = "q_mt";
1246 static char __pyx_k_rho2[] = "rho2";
1247 static char __pyx_k_rhom[] = "rhom";
1248 static char __pyx_k_sBar[] = "sBar";
1249 static char __pyx_k_test[] = "__test__";
1250 static char __pyx_k_u_eN[] = "u_eN";
1251 static char __pyx_k_vBar[] = "vBar";
1252 static char __pyx_k_a_avg[] = "a_avg";
1253 static char __pyx_k_alpha[] = "alpha";
1254 static char __pyx_k_clock[] = "clock";
1255 static char __pyx_k_denom[] = "denom";
1256 static char __pyx_k_drhom[] = "drhom";
1257 static char __pyx_k_kr_eN[] = "kr_eN";
1258 static char __pyx_k_matID[] = "matID";
1259 static char __pyx_k_numer[] = "numer";
1260 static char __pyx_k_numpy[] = "numpy";
1261 static char __pyx_k_pcBar[] = "pcBar";
1262 static char __pyx_k_q_dkr[] = "q_dkr";
1263 static char __pyx_k_q_dmt[] = "q_dmt";
1264 static char __pyx_k_range[] = "range";
1265 static char __pyx_k_shape[] = "shape";
1266 static char __pyx_k_u_dof[] = "u_dof";
1267 static char __pyx_k_u_l2g[] = "u_l2g";
1268 static char __pyx_k_vBar2[] = "vBar2";
1269 static char __pyx_k_vol_e[] = "vol_e";
1270 static char __pyx_k_zeros[] = "zeros";
1271 static char __pyx_k_a_neig[] = "a_neig";
1272 static char __pyx_k_colind[] = "colind";
1273 static char __pyx_k_dkr_up[] = "dkr_up";
1274 static char __pyx_k_import[] = "__import__";
1275 static char __pyx_k_mt_avg[] = "mt_avg";
1276 static char __pyx_k_nSpace[] = "nSpace";
1277 static char __pyx_k_phi_eN[] = "phi_eN";
1278 static char __pyx_k_picard[] = "picard";
1279 static char __pyx_k_q_alin[] = "q_alin";
1280 static char __pyx_k_q_detJ[] = "q_detJ";
1281 static char __pyx_k_q_flin[] = "q_flin";
1282 static char __pyx_k_q_mass[] = "q_mass";
1283 static char __pyx_k_q_vals[] = "q_vals";
1284 static char __pyx_k_rowptr[] = "rowptr";
1285 static char __pyx_k_thetaR[] = "thetaR";
1286 static char __pyx_k_thetaS[] = "thetaS";
1287 static char __pyx_k_thetaW[] = "thetaW";
1288 static char __pyx_k_u_neig[] = "u_neig";
1289 static char __pyx_k_volume[] = "volume";
1290 static char __pyx_k_weight[] = "weight";
1291 static char __pyx_k_df_dofs[] = "df_dofs";
1292 static char __pyx_k_eN_left[] = "eN_left";
1293 static char __pyx_k_gravity[] = "gravity";
1294 static char __pyx_k_kr_neig[] = "kr_neig";
1295 static char __pyx_k_nSpace2[] = "nSpace2";
1296 static char __pyx_k_omega_e[] = "omega_e";
1297 static char __pyx_k_pcBar_n[] = "pcBar_n";
1298 static char __pyx_k_q_dmass[] = "q_dmass";
1299 static char __pyx_k_q_kr_up[] = "q_kr_up";
1300 static char __pyx_k_thetaSR[] = "thetaSR";
1301 static char __pyx_k_dmtj_avg[] = "dmtj_avg";
1302 static char __pyx_k_eN_right[] = "eN_right";
1303 static char __pyx_k_ebq_vals[] = "ebq_vals";
1304 static char __pyx_k_integral[] = "integral";
1305 static char __pyx_k_material[] = "material";
1306 static char __pyx_k_phi_neig[] = "phi_neig";
1307 static char __pyx_k_q_grad_u[] = "q_grad_u";
1308 static char __pyx_k_q_grad_v[] = "q_grad_v";
1309 static char __pyx_k_q_grad_w[] = "q_grad_w";
1310 static char __pyx_k_ebN_local[] = "ebN_local";
1311 static char __pyx_k_pcBar_nM1[] = "pcBar_nM1";
1312 static char __pyx_k_pcBar_nM2[] = "pcBar_nM2";
1313 static char __pyx_k_sqrt_sBar[] = "sqrt_sBar";
1314 static char __pyx_k_transient[] = "transient";
1315 static char __pyx_k_volFactor[] = "volFactor";
1316 static char __pyx_k_zVelocity[] = "zVelocity";
1317 static char __pyx_k_zvelocity[] = "zvelocity";
1318 static char __pyx_k_DKWr_DpsiC[] = "DKWr_DpsiC";
1319 static char __pyx_k_ValueError[] = "ValueError";
1320 static char __pyx_k_matID_neig[] = "matID_neig";
1321 static char __pyx_k_nAvgWeight[] = "nAvgWeight";
1322 static char __pyx_k_upwindFlag[] = "upwindFlag";
1323 static char __pyx_k_DsBar_DpsiC[] = "DsBar_DpsiC";
1324 static char __pyx_k_DvBar_DpsiC[] = "DvBar_DpsiC";
1325 static char __pyx_k_eN_neighbor[] = "eN_neighbor";
1326 static char __pyx_k_RuntimeError[] = "RuntimeError";
1327 static char __pyx_k_tForReversal[] = "tForReversal";
1328 static char __pyx_k_DthetaW_DpsiC[] = "DthetaW_DpsiC";
1329 static char __pyx_k_material_left[] = "material_left";
1330 static char __pyx_k_weak_residual[] = "weak_residual";
1331 static char __pyx_k_material_right[] = "material_right";
1332 static char __pyx_k_ebq_global_vals[] = "ebq_global_vals";
1333 static char __pyx_k_elementJacobian[] = "elementJacobian";
1334 static char __pyx_k_elementResidual[] = "elementResidual";
1335 static char __pyx_k_onePlus_pcBar_n[] = "onePlus_pcBar_n";
1336 static char __pyx_k_nElements_global[] = "nElements_global";
1337 static char __pyx_k_nDOF_test_element[] = "nDOF_test_element";
1338 static char __pyx_k_material_functions[] = "material_functions";
1339 static char __pyx_k_nDOF_trial_element[] = "nDOF_trial_element";
1340 static char __pyx_k_updateMass_weakAvg[] = "updateMass_weakAvg";
1341 static char __pyx_k_calculateNormalFlux[] = "calculateNormalFlux";
1342 static char __pyx_k_thisElementIsUpwind[] = "thisElementIsUpwind";
1343 static char __pyx_k_elementBoundaryTypes[] = "elementBoundaryTypes";
1344 static char __pyx_k_elementMaterialTypes[] = "elementMaterialTypes";
1345 static char __pyx_k_elementNeighborsArray[] = "elementNeighborsArray";
1346 static char __pyx_k_elementBoundariesArray[] = "elementBoundariesArray";
1347 static char __pyx_k_jacobian_weak_residual[] = "jacobian_weak_residual";
1348 static char __pyx_k_characteristic_velocity[] = "characteristic_velocity";
1349 static char __pyx_k_elementBarycentersArray[] = "elementBarycentersArray";
1350 static char __pyx_k_nElementBoundaries_global[] = "nElementBoundaries_global";
1351 static char __pyx_k_setElementBoundariesArray[] = "setElementBoundariesArray";
1352 static char __pyx_k_RE_NCP1_getElementJacobian[] = "RE_NCP1_getElementJacobian";
1353 static char __pyx_k_RE_NCP1_getElementResidual[] = "RE_NCP1_getElementResidual";
1354 static char __pyx_k_nElementBoundaries_element[] = "nElementBoundaries_element";
1355 static char __pyx_k_updateMassJacobian_weakAvg[] = "updateMassJacobian_weakAvg";
1356 static char __pyx_k_vortexElementVelocityEval3[] = "vortexElementVelocityEval3";
1357 static char __pyx_k_vortexElementVelocityEval4[] = "vortexElementVelocityEval4";
1358 static char __pyx_k_helicalElementVelocityEval3[] = "helicalElementVelocityEval3";
1359 static char __pyx_k_helicalElementVelocityEval4[] = "helicalElementVelocityEval4";
1360 static char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
1361 static char __pyx_k_characteristic_velocity_dofs[] = "characteristic_velocity_dofs";
1362 static char __pyx_k_elementBoundaryElementsArray[] = "elementBoundaryElementsArray";
1363 static char __pyx_k_elementBoundaryMaterialTypes[] = "elementBoundaryMaterialTypes";
1364 static char __pyx_k_subsurfaceTransportFunctions[] = "subsurfaceTransportFunctions";
1365 static char __pyx_k_exteriorElementBoundariesArray[] = "exteriorElementBoundariesArray";
1366 static char __pyx_k_home_cekees_proteus_proteus_sub[] = "/home/cekees/proteus/proteus/subsurfaceTransportFunctions.pyx";
1367 static char __pyx_k_setExteriorElementBoundaryTypes[] = "setExteriorElementBoundaryTypes";
1368 static char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
1369 static char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
1370 static char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
1371 static char __pyx_k_RE_NCP1_evaluateElementCoefficie[] = "RE_NCP1_evaluateElementCoefficients_Linear";
1372 static char __pyx_k_computeSimpleCharacteristicVeloc[] = "computeSimpleCharacteristicVelocityFromElementVelocity";
1373 static char __pyx_k_evaluateScalarMaterialFunctionOv[] = "evaluateScalarMaterialFunctionOverElements";
1374 static char __pyx_k_evaluateSparseTensorMaterialFunc[] = "evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage";
1375 static char __pyx_k_evaluateVectorMaterialFunctionOv[] = "evaluateVectorMaterialFunctionOverElements";
1376 static char __pyx_k_exteriorElementBoundaryMaterialT[] = "exteriorElementBoundaryMaterialTypes";
1377 static char __pyx_k_nExteriorElementBoundaries_globa[] = "nExteriorElementBoundaries_global";
1378 static char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous";
1379 static char __pyx_k_rotatingGaussianElementVelocityE[] = "rotatingGaussianElementVelocityEval3";
1380 static char __pyx_k_setScalarMaterialFunctionOverEle[] = "setScalarMaterialFunctionOverElements";
1381 static char __pyx_k_setScalarMaterialFunctionOverGlo[] = "setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage";
1382 static char __pyx_k_setSparseTensorMaterialFunctionO[] = "setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage";
1383 static char __pyx_k_setVectorMaterialFunctionOverEle[] = "setVectorMaterialFunctionOverElements";
1384 static char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
1385 static char __pyx_k_RE_NCP1_evaluateElementCoefficie_2[] = "RE_NCP1_evaluateElementCoefficients_VGM";
1386 static char __pyx_k_computeSimpleCharacteristicVeloc_2[] = "computeSimpleCharacteristicVelocityFromVelocityDOFs";
1387 static char __pyx_k_evaluateScalarMaterialFunctionOv_2[] = "evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage";
1388 static char __pyx_k_evaluateScalarMaterialFunctionOv_3[] = "evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage";
1389 static char __pyx_k_evaluateSparseTensorMaterialFunc_2[] = "evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage";
1390 static char __pyx_k_rotatingGaussianElementVelocityE_2[] = "rotatingGaussianElementVelocityEval4";
1391 static char __pyx_k_setScalarMaterialFunctionOverEle_2[] = "setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage";
1392 static char __pyx_k_setSparseTensorMaterialFunctionO_2[] = "setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage";
1393 static PyObject *__pyx_n_s_DKWr_DpsiC;
1394 static PyObject *__pyx_n_s_DsBar_DpsiC;
1395 static PyObject *__pyx_n_s_DthetaW_DpsiC;
1396 static PyObject *__pyx_n_s_DvBar_DpsiC;
1397 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
1398 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
1399 static PyObject *__pyx_n_s_I;
1400 static PyObject *__pyx_n_s_J;
1401 static PyObject *__pyx_n_s_KWr;
1402 static PyObject *__pyx_n_s_KWs;
1403 static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
1404 static PyObject *__pyx_n_s_RE_NCP1_evaluateElementCoefficie;
1405 static PyObject *__pyx_n_s_RE_NCP1_evaluateElementCoefficie_2;
1406 static PyObject *__pyx_n_s_RE_NCP1_getElementJacobian;
1407 static PyObject *__pyx_n_s_RE_NCP1_getElementResidual;
1408 static PyObject *__pyx_n_s_RuntimeError;
1409 static PyObject *__pyx_n_s_ValueError;
1410 static PyObject *__pyx_n_s_a_avg;
1411 static PyObject *__pyx_n_s_a_eN;
1412 static PyObject *__pyx_n_s_a_neig;
1413 static PyObject *__pyx_n_s_a_up;
1414 static PyObject *__pyx_n_s_alpha;
1415 static PyObject *__pyx_n_s_beta;
1416 static PyObject *__pyx_n_s_calculateNormalFlux;
1417 static PyObject *__pyx_n_s_characteristic_velocity;
1418 static PyObject *__pyx_n_s_characteristic_velocity_dofs;
1419 static PyObject *__pyx_n_s_clock;
1420 static PyObject *__pyx_n_s_colind;
1421 static PyObject *__pyx_n_s_computeSimpleCharacteristicVeloc;
1422 static PyObject *__pyx_n_s_computeSimpleCharacteristicVeloc_2;
1423 static PyObject *__pyx_n_s_d;
1424 static PyObject *__pyx_n_s_dS;
1425 static PyObject *__pyx_n_s_dV;
1426 static PyObject *__pyx_n_s_denom;
1427 static PyObject *__pyx_n_s_df;
1428 static PyObject *__pyx_n_s_df_dofs;
1429 static PyObject *__pyx_n_s_dkr_up;
1430 static PyObject *__pyx_n_s_dm;
1431 static PyObject *__pyx_n_s_dmt;
1432 static PyObject *__pyx_n_s_dmtj_avg;
1433 static PyObject *__pyx_n_s_dot;
1434 static PyObject *__pyx_n_s_drhom;
1435 static PyObject *__pyx_n_s_eN;
1436 static PyObject *__pyx_n_s_eN_left;
1437 static PyObject *__pyx_n_s_eN_neighbor;
1438 static PyObject *__pyx_n_s_eN_right;
1439 static PyObject *__pyx_n_s_ebN;
1440 static PyObject *__pyx_n_s_ebNE;
1441 static PyObject *__pyx_n_s_ebN_local;
1442 static PyObject *__pyx_n_s_ebq_global_vals;
1443 static PyObject *__pyx_n_s_ebq_vals;
1444 static PyObject *__pyx_n_s_elementBarycentersArray;
1445 static PyObject *__pyx_n_s_elementBoundariesArray;
1446 static PyObject *__pyx_n_s_elementBoundaryElementsArray;
1447 static PyObject *__pyx_n_s_elementBoundaryMaterialTypes;
1448 static PyObject *__pyx_n_s_elementBoundaryTypes;
1449 static PyObject *__pyx_n_s_elementJacobian;
1450 static PyObject *__pyx_n_s_elementMaterialTypes;
1451 static PyObject *__pyx_n_s_elementNeighborsArray;
1452 static PyObject *__pyx_n_s_elementResidual;
1453 static PyObject *__pyx_n_s_evaluateScalarMaterialFunctionOv;
1454 static PyObject *__pyx_n_s_evaluateScalarMaterialFunctionOv_2;
1455 static PyObject *__pyx_n_s_evaluateScalarMaterialFunctionOv_3;
1456 static PyObject *__pyx_n_s_evaluateSparseTensorMaterialFunc;
1457 static PyObject *__pyx_n_s_evaluateSparseTensorMaterialFunc_2;
1458 static PyObject *__pyx_n_s_evaluateVectorMaterialFunctionOv;
1459 static PyObject *__pyx_n_s_exteriorElementBoundariesArray;
1460 static PyObject *__pyx_n_s_exteriorElementBoundaryMaterialT;
1461 static PyObject *__pyx_n_s_f_up;
1462 static PyObject *__pyx_n_s_flat;
1463 static PyObject *__pyx_n_s_flux;
1464 static PyObject *__pyx_n_s_gravity;
1465 static PyObject *__pyx_n_s_helicalElementVelocityEval3;
1466 static PyObject *__pyx_n_s_helicalElementVelocityEval4;
1467 static PyObject *__pyx_kp_s_home_cekees_proteus_proteus_sub;
1468 static PyObject *__pyx_n_s_i;
1469 static PyObject *__pyx_n_s_ii;
1470 static PyObject *__pyx_n_s_import;
1471 static PyObject *__pyx_n_s_integral;
1472 static PyObject *__pyx_n_s_j;
1473 static PyObject *__pyx_n_s_jacobian_weak_residual;
1474 static PyObject *__pyx_n_s_k;
1475 static PyObject *__pyx_n_s_kb;
1476 static PyObject *__pyx_n_s_kr_eN;
1477 static PyObject *__pyx_n_s_kr_neig;
1478 static PyObject *__pyx_n_s_l2g;
1479 static PyObject *__pyx_n_s_m;
1480 static PyObject *__pyx_n_s_main;
1481 static PyObject *__pyx_n_s_matID;
1482 static PyObject *__pyx_n_s_matID_neig;
1483 static PyObject *__pyx_n_s_material;
1484 static PyObject *__pyx_n_s_material_functions;
1485 static PyObject *__pyx_n_s_material_left;
1486 static PyObject *__pyx_n_s_material_right;
1487 static PyObject *__pyx_n_s_mt;
1488 static PyObject *__pyx_n_s_mt_avg;
1489 static PyObject *__pyx_n_s_n;
1490 static PyObject *__pyx_n_s_nAvgWeight;
1491 static PyObject *__pyx_n_s_nDOF_test_element;
1492 static PyObject *__pyx_n_s_nDOF_trial_element;
1493 static PyObject *__pyx_n_s_nElementBoundaries_element;
1494 static PyObject *__pyx_n_s_nElementBoundaries_global;
1495 static PyObject *__pyx_n_s_nElements_global;
1496 static PyObject *__pyx_n_s_nExteriorElementBoundaries_globa;
1497 static PyObject *__pyx_n_s_nSpace;
1498 static PyObject *__pyx_n_s_nSpace2;
1499 static PyObject *__pyx_n_s_nd;
1500 static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous;
1501 static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou;
1502 static PyObject *__pyx_n_s_nnz;
1503 static PyObject *__pyx_n_s_numer;
1504 static PyObject *__pyx_n_s_numpy;
1505 static PyObject *__pyx_n_s_omega_e;
1506 static PyObject *__pyx_n_s_one8;
1507 static PyObject *__pyx_n_s_onePlus_pcBar_n;
1508 static PyObject *__pyx_n_s_pcBar;
1509 static PyObject *__pyx_n_s_pcBar_n;
1510 static PyObject *__pyx_n_s_pcBar_nM1;
1511 static PyObject *__pyx_n_s_pcBar_nM2;
1512 static PyObject *__pyx_n_s_phi_eN;
1513 static PyObject *__pyx_n_s_phi_neig;
1514 static PyObject *__pyx_n_s_pi;
1515 static PyObject *__pyx_n_s_picard;
1516 static PyObject *__pyx_n_s_psiC;
1517 static PyObject *__pyx_n_s_q;
1518 static PyObject *__pyx_n_s_q_alin;
1519 static PyObject *__pyx_n_s_q_detJ;
1520 static PyObject *__pyx_n_s_q_dkr;
1521 static PyObject *__pyx_n_s_q_dm;
1522 static PyObject *__pyx_n_s_q_dmass;
1523 static PyObject *__pyx_n_s_q_dmt;
1524 static PyObject *__pyx_n_s_q_flin;
1525 static PyObject *__pyx_n_s_q_grad_u;
1526 static PyObject *__pyx_n_s_q_grad_v;
1527 static PyObject *__pyx_n_s_q_grad_w;
1528 static PyObject *__pyx_n_s_q_kr;
1529 static PyObject *__pyx_n_s_q_kr_up;
1530 static PyObject *__pyx_n_s_q_m;
1531 static PyObject *__pyx_n_s_q_mass;
1532 static PyObject *__pyx_n_s_q_mt;
1533 static PyObject *__pyx_n_s_q_r;
1534 static PyObject *__pyx_n_s_q_u;
1535 static PyObject *__pyx_n_s_q_vals;
1536 static PyObject *__pyx_n_s_q_x;
1537 static PyObject *__pyx_n_s_range;
1538 static PyObject *__pyx_n_s_rho;
1539 static PyObject *__pyx_n_s_rho2;
1540 static PyObject *__pyx_n_s_rhom;
1541 static PyObject *__pyx_n_s_rotatingGaussianElementVelocityE;
1542 static PyObject *__pyx_n_s_rotatingGaussianElementVelocityE_2;
1543 static PyObject *__pyx_n_s_rowptr;
1544 static PyObject *__pyx_n_s_sBar;
1545 static PyObject *__pyx_n_s_setElementBoundariesArray;
1546 static PyObject *__pyx_n_s_setExteriorElementBoundaryTypes;
1547 static PyObject *__pyx_n_s_setScalarMaterialFunctionOverEle;
1548 static PyObject *__pyx_n_s_setScalarMaterialFunctionOverEle_2;
1549 static PyObject *__pyx_n_s_setScalarMaterialFunctionOverGlo;
1550 static PyObject *__pyx_n_s_setSparseTensorMaterialFunctionO;
1551 static PyObject *__pyx_n_s_setSparseTensorMaterialFunctionO_2;
1552 static PyObject *__pyx_n_s_setVectorMaterialFunctionOverEle;
1553 static PyObject *__pyx_n_s_shape;
1554 static PyObject *__pyx_n_s_sqrt_sBar;
1555 static PyObject *__pyx_n_s_subsurfaceTransportFunctions;
1556 static PyObject *__pyx_n_s_sum;
1557 static PyObject *__pyx_n_s_t;
1558 static PyObject *__pyx_n_s_tForReversal;
1559 static PyObject *__pyx_n_s_test;
1560 static PyObject *__pyx_n_s_thetaR;
1561 static PyObject *__pyx_n_s_thetaS;
1562 static PyObject *__pyx_n_s_thetaSR;
1563 static PyObject *__pyx_n_s_thetaW;
1564 static PyObject *__pyx_n_s_thisElementIsUpwind;
1565 static PyObject *__pyx_n_s_transient;
1566 static PyObject *__pyx_n_s_u_dof;
1567 static PyObject *__pyx_n_s_u_eN;
1568 static PyObject *__pyx_n_s_u_j;
1569 static PyObject *__pyx_n_s_u_l2g;
1570 static PyObject *__pyx_n_s_u_neig;
1571 static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
1572 static PyObject *__pyx_n_s_updateMassJacobian_weakAvg;
1573 static PyObject *__pyx_n_s_updateMass_weakAvg;
1574 static PyObject *__pyx_n_s_upwindFlag;
1575 static PyObject *__pyx_n_s_v;
1576 static PyObject *__pyx_n_s_vBar;
1577 static PyObject *__pyx_n_s_vBar2;
1578 static PyObject *__pyx_n_s_vol;
1579 static PyObject *__pyx_n_s_volFactor;
1580 static PyObject *__pyx_n_s_vol_e;
1581 static PyObject *__pyx_n_s_volume;
1582 static PyObject *__pyx_n_s_vortexElementVelocityEval3;
1583 static PyObject *__pyx_n_s_vortexElementVelocityEval4;
1584 static PyObject *__pyx_n_s_w;
1585 static PyObject *__pyx_n_s_weak_residual;
1586 static PyObject *__pyx_n_s_weight;
1587 static PyObject *__pyx_n_s_x;
1588 static PyObject *__pyx_n_s_xc;
1589 static PyObject *__pyx_n_s_yc;
1590 static PyObject *__pyx_n_s_zVelocity;
1591 static PyObject *__pyx_n_s_zeros;
1592 static PyObject *__pyx_n_s_zvelocity;
1593 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_setExteriorElementBoundaryTypes(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nExteriorElementBoundaries_global, PyArrayObject *__pyx_v_exteriorElementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryElementsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_exteriorElementBoundaryMaterialTypes); /* proto */
1594 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_2setElementBoundariesArray(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nElementBoundaries_global, PyArrayObject *__pyx_v_elementBoundaryElementsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_elementBoundaryMaterialTypes); /* proto */
1595 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions); /* proto */
1596 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions); /* proto */
1597 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions); /* proto */
1598 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions); /* proto */
1599 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions); /* proto */
1600 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions); /* proto */
1601 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions); /* proto */
1602 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions); /* proto */
1603 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions); /* proto */
1604 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_22evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, double __pyx_v_t, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions); /* proto */
1605 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_24evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions); /* proto */
1606 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_26evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, double __pyx_v_t, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions); /* proto */
1607 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_28RE_NCP1_evaluateElementCoefficients_Linear(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_rho, PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, PyArrayObject *__pyx_v_KWs, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, PyArrayObject *__pyx_v_elementNeighborsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin); /* proto */
1608 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_30RE_NCP1_evaluateElementCoefficients_VGM(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_rho, double __pyx_v_beta, PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_alpha, PyArrayObject *__pyx_v_n, PyArrayObject *__pyx_v_thetaR, PyArrayObject *__pyx_v_thetaSR, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, PyArrayObject *__pyx_v_elementNeighborsArray, PyArrayObject *__pyx_v_elementBarycentersArray, PyArrayObject *__pyx_v_elementMaterialTypes, int __pyx_v_nDOF_trial_element, PyArrayObject *__pyx_v_u_l2g, PyArrayObject *__pyx_v_u_dof, CYTHON_UNUSED PyArrayObject *__pyx_v_q_x, PyArrayObject *__pyx_v_q_u, PyArrayObject *__pyx_v_q_mass, PyArrayObject *__pyx_v_q_dmass, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, PyArrayObject *__pyx_v_q_dkr, PyArrayObject *__pyx_v_q_kr_up); /* proto */
1609 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_32RE_NCP1_getElementResidual(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray, int __pyx_v_nDOF_test_element, PyArrayObject *__pyx_v_q_u, PyArrayObject *__pyx_v_q_grad_u, PyArrayObject *__pyx_v_q_grad_w, PyArrayObject *__pyx_v_q_detJ, PyArrayObject *__pyx_v_q_m, PyArrayObject *__pyx_v_q_mt, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, PyArrayObject *__pyx_v_q_kr_up, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin, PyArrayObject *__pyx_v_elementResidual); /* proto */
1610 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_34RE_NCP1_getElementJacobian(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray, int __pyx_v_nDOF_test_element, int __pyx_v_nDOF_trial_element, PyArrayObject *__pyx_v_q_u, CYTHON_UNUSED PyArrayObject *__pyx_v_q_grad_u, PyArrayObject *__pyx_v_q_grad_w, PyArrayObject *__pyx_v_q_grad_v, PyArrayObject *__pyx_v_q_detJ, PyArrayObject *__pyx_v_q_m, CYTHON_UNUSED PyArrayObject *__pyx_v_q_dm, PyArrayObject *__pyx_v_q_mt, PyArrayObject *__pyx_v_q_dmt, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, CYTHON_UNUSED PyArrayObject *__pyx_v_q_dkr, PyArrayObject *__pyx_v_q_kr_up, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin, PyArrayObject *__pyx_v_elementJacobian); /* proto */
1611 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_36updateMass_weakAvg(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_mt, PyArrayObject *__pyx_v_w, PyArrayObject *__pyx_v_dV, PyArrayObject *__pyx_v_weak_residual); /* proto */
1612 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_38updateMassJacobian_weakAvg(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_dmt, PyArrayObject *__pyx_v_w, PyArrayObject *__pyx_v_v, PyArrayObject *__pyx_v_dV, PyArrayObject *__pyx_v_jacobian_weak_residual); /* proto */
1613 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_40calculateNormalFlux(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_v, PyArrayObject *__pyx_v_n, PyArrayObject *__pyx_v_dS, PyArrayObject *__pyx_v_flux); /* proto */
1614 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_42computeSimpleCharacteristicVelocityFromElementVelocity(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_df, PyArrayObject *__pyx_v_characteristic_velocity, PyArrayObject *__pyx_v_dm, PyArrayObject *__pyx_v_dV); /* proto */
1615 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_44computeSimpleCharacteristicVelocityFromVelocityDOFs(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_df_dofs, PyArrayObject *__pyx_v_characteristic_velocity_dofs, PyArrayObject *__pyx_v_l2g, PyArrayObject *__pyx_v_dm, PyArrayObject *__pyx_v_dV); /* proto */
1616 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_46rotatingGaussianElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v, double __pyx_v_zvelocity); /* proto */
1617 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_48rotatingGaussianElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v, double __pyx_v_zvelocity); /* proto */
1618 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_50helicalElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_zVelocity, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v); /* proto */
1619 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_52helicalElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_zVelocity, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v); /* proto */
1620 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_54vortexElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v); /* proto */
1621 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_56vortexElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v); /* proto */
1622 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
1623 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
1624 static PyObject *__pyx_float_0_0;
1625 static PyObject *__pyx_float_0_5;
1626 static PyObject *__pyx_float_2_0;
1627 static PyObject *__pyx_float_1_0eneg_20;
1628 static PyObject *__pyx_slice_;
1629 static PyObject *__pyx_slice__2;
1630 static PyObject *__pyx_slice__3;
1631 static PyObject *__pyx_slice__4;
1632 static PyObject *__pyx_slice__5;
1633 static PyObject *__pyx_slice__6;
1634 static PyObject *__pyx_slice__7;
1635 static PyObject *__pyx_slice__8;
1636 static PyObject *__pyx_tuple__9;
1637 static PyObject *__pyx_tuple__10;
1638 static PyObject *__pyx_tuple__11;
1639 static PyObject *__pyx_tuple__12;
1640 static PyObject *__pyx_tuple__13;
1641 static PyObject *__pyx_tuple__14;
1642 static PyObject *__pyx_tuple__15;
1643 static PyObject *__pyx_tuple__17;
1644 static PyObject *__pyx_tuple__19;
1645 static PyObject *__pyx_tuple__21;
1646 static PyObject *__pyx_tuple__23;
1647 static PyObject *__pyx_tuple__25;
1648 static PyObject *__pyx_tuple__27;
1649 static PyObject *__pyx_tuple__29;
1650 static PyObject *__pyx_tuple__31;
1651 static PyObject *__pyx_tuple__33;
1652 static PyObject *__pyx_tuple__35;
1653 static PyObject *__pyx_tuple__37;
1654 static PyObject *__pyx_tuple__39;
1655 static PyObject *__pyx_tuple__41;
1656 static PyObject *__pyx_tuple__43;
1657 static PyObject *__pyx_tuple__45;
1658 static PyObject *__pyx_tuple__47;
1659 static PyObject *__pyx_tuple__49;
1660 static PyObject *__pyx_tuple__51;
1661 static PyObject *__pyx_tuple__53;
1662 static PyObject *__pyx_tuple__55;
1663 static PyObject *__pyx_tuple__57;
1664 static PyObject *__pyx_tuple__59;
1665 static PyObject *__pyx_tuple__61;
1666 static PyObject *__pyx_tuple__63;
1667 static PyObject *__pyx_tuple__65;
1668 static PyObject *__pyx_tuple__67;
1669 static PyObject *__pyx_tuple__69;
1670 static PyObject *__pyx_tuple__71;
1671 static PyObject *__pyx_codeobj__16;
1672 static PyObject *__pyx_codeobj__18;
1673 static PyObject *__pyx_codeobj__20;
1674 static PyObject *__pyx_codeobj__22;
1675 static PyObject *__pyx_codeobj__24;
1676 static PyObject *__pyx_codeobj__26;
1677 static PyObject *__pyx_codeobj__28;
1678 static PyObject *__pyx_codeobj__30;
1679 static PyObject *__pyx_codeobj__32;
1680 static PyObject *__pyx_codeobj__34;
1681 static PyObject *__pyx_codeobj__36;
1682 static PyObject *__pyx_codeobj__38;
1683 static PyObject *__pyx_codeobj__40;
1684 static PyObject *__pyx_codeobj__42;
1685 static PyObject *__pyx_codeobj__44;
1686 static PyObject *__pyx_codeobj__46;
1687 static PyObject *__pyx_codeobj__48;
1688 static PyObject *__pyx_codeobj__50;
1689 static PyObject *__pyx_codeobj__52;
1690 static PyObject *__pyx_codeobj__54;
1691 static PyObject *__pyx_codeobj__56;
1692 static PyObject *__pyx_codeobj__58;
1693 static PyObject *__pyx_codeobj__60;
1694 static PyObject *__pyx_codeobj__62;
1695 static PyObject *__pyx_codeobj__64;
1696 static PyObject *__pyx_codeobj__66;
1697 static PyObject *__pyx_codeobj__68;
1698 static PyObject *__pyx_codeobj__70;
1699 static PyObject *__pyx_codeobj__72;
1700 
1701 /* "subsurfaceTransportFunctions.pyx":11
1702  * double sin(double x)
1703  * double M_PI
1704  * cdef inline double double_max(double a, double b): return a if a >= b else b # <<<<<<<<<<<<<<
1705  * cdef inline double double_min(double a, double b): return a if a <= b else b
1706  *
1707  */
1708 
1709 static CYTHON_INLINE double __pyx_f_28subsurfaceTransportFunctions_double_max(double __pyx_v_a, double __pyx_v_b) {
1710  double __pyx_r;
1711  __Pyx_RefNannyDeclarations
1712  double __pyx_t_1;
1713  __Pyx_RefNannySetupContext("double_max", 0);
1714  if (((__pyx_v_a >= __pyx_v_b) != 0)) {
1715  __pyx_t_1 = __pyx_v_a;
1716  } else {
1717  __pyx_t_1 = __pyx_v_b;
1718  }
1719  __pyx_r = __pyx_t_1;
1720  goto __pyx_L0;
1721 
1722  /* function exit code */
1723  __pyx_L0:;
1724  __Pyx_RefNannyFinishContext();
1725  return __pyx_r;
1726 }
1727 
1728 /* "subsurfaceTransportFunctions.pyx":12
1729  * double M_PI
1730  * cdef inline double double_max(double a, double b): return a if a >= b else b
1731  * cdef inline double double_min(double a, double b): return a if a <= b else b # <<<<<<<<<<<<<<
1732  *
1733  * ctypedef numpy.double_t DTYPE_t
1734  */
1735 
1736 static CYTHON_INLINE double __pyx_f_28subsurfaceTransportFunctions_double_min(double __pyx_v_a, double __pyx_v_b) {
1737  double __pyx_r;
1738  __Pyx_RefNannyDeclarations
1739  double __pyx_t_1;
1740  __Pyx_RefNannySetupContext("double_min", 0);
1741  if (((__pyx_v_a <= __pyx_v_b) != 0)) {
1742  __pyx_t_1 = __pyx_v_a;
1743  } else {
1744  __pyx_t_1 = __pyx_v_b;
1745  }
1746  __pyx_r = __pyx_t_1;
1747  goto __pyx_L0;
1748 
1749  /* function exit code */
1750  __pyx_L0:;
1751  __Pyx_RefNannyFinishContext();
1752  return __pyx_r;
1753 }
1754 
1755 /* "subsurfaceTransportFunctions.pyx":18
1756  * ctypedef int ITYPE_t
1757  *
1758  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global, # <<<<<<<<<<<<<<
1759  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundariesArray,
1760  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
1761  */
1762 
1763 /* Python wrapper */
1764 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1765 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes = {"setExteriorElementBoundaryTypes", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes, METH_VARARGS|METH_KEYWORDS, 0};
1766 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1767  int __pyx_v_nExteriorElementBoundaries_global;
1768  PyArrayObject *__pyx_v_exteriorElementBoundariesArray = 0;
1769  PyArrayObject *__pyx_v_elementBoundaryElementsArray = 0;
1770  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
1771  PyArrayObject *__pyx_v_exteriorElementBoundaryMaterialTypes = 0;
1772  int __pyx_lineno = 0;
1773  const char *__pyx_filename = NULL;
1774  int __pyx_clineno = 0;
1775  PyObject *__pyx_r = 0;
1776  __Pyx_RefNannyDeclarations
1777  __Pyx_RefNannySetupContext("setExteriorElementBoundaryTypes (wrapper)", 0);
1778  {
1779  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nExteriorElementBoundaries_globa,&__pyx_n_s_exteriorElementBoundariesArray,&__pyx_n_s_elementBoundaryElementsArray,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_exteriorElementBoundaryMaterialT,0};
1780  PyObject* values[5] = {0,0,0,0,0};
1781  if (unlikely(__pyx_kwds)) {
1782  Py_ssize_t kw_args;
1783  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1784  switch (pos_args) {
1785  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
1786  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
1787  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1788  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1789  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1790  case 0: break;
1791  default: goto __pyx_L5_argtuple_error;
1792  }
1793  kw_args = PyDict_Size(__pyx_kwds);
1794  switch (pos_args) {
1795  case 0:
1796  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nExteriorElementBoundaries_globa)) != 0)) kw_args--;
1797  else goto __pyx_L5_argtuple_error;
1798  case 1:
1799  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_exteriorElementBoundariesArray)) != 0)) kw_args--;
1800  else {
1801  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1802  }
1803  case 2:
1804  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundaryElementsArray)) != 0)) kw_args--;
1805  else {
1806  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1807  }
1808  case 3:
1809  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
1810  else {
1811  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1812  }
1813  case 4:
1814  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_exteriorElementBoundaryMaterialT)) != 0)) kw_args--;
1815  else {
1816  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1817  }
1818  }
1819  if (unlikely(kw_args > 0)) {
1820  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setExteriorElementBoundaryTypes") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1821  }
1822  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
1823  goto __pyx_L5_argtuple_error;
1824  } else {
1825  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1826  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1827  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1828  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
1829  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
1830  }
1831  __pyx_v_nExteriorElementBoundaries_global = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nExteriorElementBoundaries_global == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1832  __pyx_v_exteriorElementBoundariesArray = ((PyArrayObject *)values[1]);
1833  __pyx_v_elementBoundaryElementsArray = ((PyArrayObject *)values[2]);
1834  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[3]);
1835  __pyx_v_exteriorElementBoundaryMaterialTypes = ((PyArrayObject *)values[4]);
1836  }
1837  goto __pyx_L4_argument_unpacking_done;
1838  __pyx_L5_argtuple_error:;
1839  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1840  __pyx_L3_error:;
1841  __Pyx_AddTraceback("subsurfaceTransportFunctions.setExteriorElementBoundaryTypes", __pyx_clineno, __pyx_lineno, __pyx_filename);
1842  __Pyx_RefNannyFinishContext();
1843  return NULL;
1844  __pyx_L4_argument_unpacking_done:;
1845  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_exteriorElementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "exteriorElementBoundariesArray", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1846  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryElementsArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryElementsArray", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1847  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1848  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_exteriorElementBoundaryMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "exteriorElementBoundaryMaterialTypes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1849  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_setExteriorElementBoundaryTypes(__pyx_self, __pyx_v_nExteriorElementBoundaries_global, __pyx_v_exteriorElementBoundariesArray, __pyx_v_elementBoundaryElementsArray, __pyx_v_elementMaterialTypes, __pyx_v_exteriorElementBoundaryMaterialTypes);
1850 
1851  /* function exit code */
1852  goto __pyx_L0;
1853  __pyx_L1_error:;
1854  __pyx_r = NULL;
1855  __pyx_L0:;
1856  __Pyx_RefNannyFinishContext();
1857  return __pyx_r;
1858 }
1859 
1860 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_setExteriorElementBoundaryTypes(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nExteriorElementBoundaries_global, PyArrayObject *__pyx_v_exteriorElementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryElementsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_exteriorElementBoundaryMaterialTypes) {
1861  int __pyx_v_ebNE;
1862  int __pyx_v_ebN;
1863  int __pyx_v_eN;
1864  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryElementsArray;
1865  __Pyx_Buffer __pyx_pybuffer_elementBoundaryElementsArray;
1866  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
1867  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
1868  __Pyx_LocalBuf_ND __pyx_pybuffernd_exteriorElementBoundariesArray;
1869  __Pyx_Buffer __pyx_pybuffer_exteriorElementBoundariesArray;
1870  __Pyx_LocalBuf_ND __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes;
1871  __Pyx_Buffer __pyx_pybuffer_exteriorElementBoundaryMaterialTypes;
1872  PyObject *__pyx_r = NULL;
1873  __Pyx_RefNannyDeclarations
1874  int __pyx_t_1;
1875  int __pyx_t_2;
1876  Py_ssize_t __pyx_t_3;
1877  int __pyx_t_4;
1878  Py_ssize_t __pyx_t_5;
1879  Py_ssize_t __pyx_t_6;
1880  Py_ssize_t __pyx_t_7;
1881  Py_ssize_t __pyx_t_8;
1882  int __pyx_lineno = 0;
1883  const char *__pyx_filename = NULL;
1884  int __pyx_clineno = 0;
1885  __Pyx_RefNannySetupContext("setExteriorElementBoundaryTypes", 0);
1886  __pyx_pybuffer_exteriorElementBoundariesArray.pybuffer.buf = NULL;
1887  __pyx_pybuffer_exteriorElementBoundariesArray.refcount = 0;
1888  __pyx_pybuffernd_exteriorElementBoundariesArray.data = NULL;
1889  __pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer = &__pyx_pybuffer_exteriorElementBoundariesArray;
1890  __pyx_pybuffer_elementBoundaryElementsArray.pybuffer.buf = NULL;
1891  __pyx_pybuffer_elementBoundaryElementsArray.refcount = 0;
1892  __pyx_pybuffernd_elementBoundaryElementsArray.data = NULL;
1893  __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer = &__pyx_pybuffer_elementBoundaryElementsArray;
1894  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
1895  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
1896  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
1897  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
1898  __pyx_pybuffer_exteriorElementBoundaryMaterialTypes.pybuffer.buf = NULL;
1899  __pyx_pybuffer_exteriorElementBoundaryMaterialTypes.refcount = 0;
1900  __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.data = NULL;
1901  __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer = &__pyx_pybuffer_exteriorElementBoundaryMaterialTypes;
1902  {
1903  __Pyx_BufFmt_StackElem __pyx_stack[1];
1904  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_exteriorElementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1905  }
1906  __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer.shape[0];
1907  {
1908  __Pyx_BufFmt_StackElem __pyx_stack[1];
1909  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryElementsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1910  }
1911  __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.shape[1];
1912  {
1913  __Pyx_BufFmt_StackElem __pyx_stack[1];
1914  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1915  }
1916  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
1917  {
1918  __Pyx_BufFmt_StackElem __pyx_stack[1];
1919  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_exteriorElementBoundaryMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1920  }
1921  __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer.shape[0];
1922 
1923  /* "subsurfaceTransportFunctions.pyx":24
1924  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundaryMaterialTypes):
1925  * cdef int ebNE,ebN,eN
1926  * for ebNE in range(nExteriorElementBoundaries_global): # <<<<<<<<<<<<<<
1927  * ebN = exteriorElementBoundariesArray[ebNE]
1928  * eN = elementBoundaryElementsArray[ebN,0]
1929  */
1930  __pyx_t_1 = __pyx_v_nExteriorElementBoundaries_global;
1931  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
1932  __pyx_v_ebNE = __pyx_t_2;
1933 
1934  /* "subsurfaceTransportFunctions.pyx":25
1935  * cdef int ebNE,ebN,eN
1936  * for ebNE in range(nExteriorElementBoundaries_global):
1937  * ebN = exteriorElementBoundariesArray[ebNE] # <<<<<<<<<<<<<<
1938  * eN = elementBoundaryElementsArray[ebN,0]
1939  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
1940  */
1941  __pyx_t_3 = __pyx_v_ebNE;
1942  __pyx_t_4 = -1;
1943  if (__pyx_t_3 < 0) {
1944  __pyx_t_3 += __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].shape;
1945  if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 0;
1946  } else if (unlikely(__pyx_t_3 >= __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].shape)) __pyx_t_4 = 0;
1947  if (unlikely(__pyx_t_4 != -1)) {
1948  __Pyx_RaiseBufferIndexError(__pyx_t_4);
1949  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1950  }
1951  __pyx_v_ebN = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].strides));
1952 
1953  /* "subsurfaceTransportFunctions.pyx":26
1954  * for ebNE in range(nExteriorElementBoundaries_global):
1955  * ebN = exteriorElementBoundariesArray[ebNE]
1956  * eN = elementBoundaryElementsArray[ebN,0] # <<<<<<<<<<<<<<
1957  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
1958  *
1959  */
1960  __pyx_t_5 = __pyx_v_ebN;
1961  __pyx_t_6 = 0;
1962  __pyx_t_4 = -1;
1963  if (__pyx_t_5 < 0) {
1964  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape;
1965  if (unlikely(__pyx_t_5 < 0)) __pyx_t_4 = 0;
1966  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape)) __pyx_t_4 = 0;
1967  if (__pyx_t_6 < 0) {
1968  __pyx_t_6 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape;
1969  if (unlikely(__pyx_t_6 < 0)) __pyx_t_4 = 1;
1970  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape)) __pyx_t_4 = 1;
1971  if (unlikely(__pyx_t_4 != -1)) {
1972  __Pyx_RaiseBufferIndexError(__pyx_t_4);
1973  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1974  }
1975  __pyx_v_eN = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides));
1976 
1977  /* "subsurfaceTransportFunctions.pyx":27
1978  * ebN = exteriorElementBoundariesArray[ebNE]
1979  * eN = elementBoundaryElementsArray[ebN,0]
1980  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
1981  *
1982  * def setElementBoundariesArray(int nElementBoundaries_global,
1983  */
1984  __pyx_t_7 = __pyx_v_eN;
1985  __pyx_t_4 = -1;
1986  if (__pyx_t_7 < 0) {
1987  __pyx_t_7 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
1988  if (unlikely(__pyx_t_7 < 0)) __pyx_t_4 = 0;
1989  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_4 = 0;
1990  if (unlikely(__pyx_t_4 != -1)) {
1991  __Pyx_RaiseBufferIndexError(__pyx_t_4);
1992  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1993  }
1994  __pyx_t_8 = __pyx_v_ebNE;
1995  __pyx_t_4 = -1;
1996  if (__pyx_t_8 < 0) {
1997  __pyx_t_8 += __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].shape;
1998  if (unlikely(__pyx_t_8 < 0)) __pyx_t_4 = 0;
1999  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].shape)) __pyx_t_4 = 0;
2000  if (unlikely(__pyx_t_4 != -1)) {
2001  __Pyx_RaiseBufferIndexError(__pyx_t_4);
2002  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2003  }
2004  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
2005  }
2006 
2007  /* "subsurfaceTransportFunctions.pyx":18
2008  * ctypedef int ITYPE_t
2009  *
2010  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global, # <<<<<<<<<<<<<<
2011  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundariesArray,
2012  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
2013  */
2014 
2015  /* function exit code */
2016  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2017  goto __pyx_L0;
2018  __pyx_L1_error:;
2019  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
2020  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
2021  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer);
2022  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
2023  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer);
2024  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer);
2025  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
2026  __Pyx_AddTraceback("subsurfaceTransportFunctions.setExteriorElementBoundaryTypes", __pyx_clineno, __pyx_lineno, __pyx_filename);
2027  __pyx_r = NULL;
2028  goto __pyx_L2;
2029  __pyx_L0:;
2030  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer);
2031  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
2032  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer);
2033  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer);
2034  __pyx_L2:;
2035  __Pyx_XGIVEREF(__pyx_r);
2036  __Pyx_RefNannyFinishContext();
2037  return __pyx_r;
2038 }
2039 
2040 /* "subsurfaceTransportFunctions.pyx":29
2041  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
2042  *
2043  * def setElementBoundariesArray(int nElementBoundaries_global, # <<<<<<<<<<<<<<
2044  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
2045  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
2046  */
2047 
2048 /* Python wrapper */
2049 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_3setElementBoundariesArray(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2050 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_3setElementBoundariesArray = {"setElementBoundariesArray", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_3setElementBoundariesArray, METH_VARARGS|METH_KEYWORDS, 0};
2051 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_3setElementBoundariesArray(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2052  int __pyx_v_nElementBoundaries_global;
2053  PyArrayObject *__pyx_v_elementBoundaryElementsArray = 0;
2054  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
2055  PyArrayObject *__pyx_v_elementBoundaryMaterialTypes = 0;
2056  int __pyx_lineno = 0;
2057  const char *__pyx_filename = NULL;
2058  int __pyx_clineno = 0;
2059  PyObject *__pyx_r = 0;
2060  __Pyx_RefNannyDeclarations
2061  __Pyx_RefNannySetupContext("setElementBoundariesArray (wrapper)", 0);
2062  {
2063  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nElementBoundaries_global,&__pyx_n_s_elementBoundaryElementsArray,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_elementBoundaryMaterialTypes,0};
2064  PyObject* values[4] = {0,0,0,0};
2065  if (unlikely(__pyx_kwds)) {
2066  Py_ssize_t kw_args;
2067  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2068  switch (pos_args) {
2069  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2070  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2071  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2072  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2073  case 0: break;
2074  default: goto __pyx_L5_argtuple_error;
2075  }
2076  kw_args = PyDict_Size(__pyx_kwds);
2077  switch (pos_args) {
2078  case 0:
2079  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nElementBoundaries_global)) != 0)) kw_args--;
2080  else goto __pyx_L5_argtuple_error;
2081  case 1:
2082  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundaryElementsArray)) != 0)) kw_args--;
2083  else {
2084  __Pyx_RaiseArgtupleInvalid("setElementBoundariesArray", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2085  }
2086  case 2:
2087  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
2088  else {
2089  __Pyx_RaiseArgtupleInvalid("setElementBoundariesArray", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2090  }
2091  case 3:
2092  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundaryMaterialTypes)) != 0)) kw_args--;
2093  else {
2094  __Pyx_RaiseArgtupleInvalid("setElementBoundariesArray", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2095  }
2096  }
2097  if (unlikely(kw_args > 0)) {
2098  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setElementBoundariesArray") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2099  }
2100  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
2101  goto __pyx_L5_argtuple_error;
2102  } else {
2103  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2104  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2105  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2106  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2107  }
2108  __pyx_v_nElementBoundaries_global = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nElementBoundaries_global == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2109  __pyx_v_elementBoundaryElementsArray = ((PyArrayObject *)values[1]);
2110  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[2]);
2111  __pyx_v_elementBoundaryMaterialTypes = ((PyArrayObject *)values[3]);
2112  }
2113  goto __pyx_L4_argument_unpacking_done;
2114  __pyx_L5_argtuple_error:;
2115  __Pyx_RaiseArgtupleInvalid("setElementBoundariesArray", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2116  __pyx_L3_error:;
2117  __Pyx_AddTraceback("subsurfaceTransportFunctions.setElementBoundariesArray", __pyx_clineno, __pyx_lineno, __pyx_filename);
2118  __Pyx_RefNannyFinishContext();
2119  return NULL;
2120  __pyx_L4_argument_unpacking_done:;
2121  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryElementsArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryElementsArray", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2122  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2123  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryMaterialTypes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2124  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_2setElementBoundariesArray(__pyx_self, __pyx_v_nElementBoundaries_global, __pyx_v_elementBoundaryElementsArray, __pyx_v_elementMaterialTypes, __pyx_v_elementBoundaryMaterialTypes);
2125 
2126  /* function exit code */
2127  goto __pyx_L0;
2128  __pyx_L1_error:;
2129  __pyx_r = NULL;
2130  __pyx_L0:;
2131  __Pyx_RefNannyFinishContext();
2132  return __pyx_r;
2133 }
2134 
2135 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_2setElementBoundariesArray(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nElementBoundaries_global, PyArrayObject *__pyx_v_elementBoundaryElementsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_elementBoundaryMaterialTypes) {
2136  int __pyx_v_ebN;
2137  int __pyx_v_eN_left;
2138  int __pyx_v_eN_right;
2139  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryElementsArray;
2140  __Pyx_Buffer __pyx_pybuffer_elementBoundaryElementsArray;
2141  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryMaterialTypes;
2142  __Pyx_Buffer __pyx_pybuffer_elementBoundaryMaterialTypes;
2143  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
2144  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
2145  PyObject *__pyx_r = NULL;
2146  __Pyx_RefNannyDeclarations
2147  int __pyx_t_1;
2148  int __pyx_t_2;
2149  Py_ssize_t __pyx_t_3;
2150  Py_ssize_t __pyx_t_4;
2151  int __pyx_t_5;
2152  Py_ssize_t __pyx_t_6;
2153  Py_ssize_t __pyx_t_7;
2154  Py_ssize_t __pyx_t_8;
2155  Py_ssize_t __pyx_t_9;
2156  Py_ssize_t __pyx_t_10;
2157  Py_ssize_t __pyx_t_11;
2158  Py_ssize_t __pyx_t_12;
2159  Py_ssize_t __pyx_t_13;
2160  int __pyx_t_14;
2161  Py_ssize_t __pyx_t_15;
2162  Py_ssize_t __pyx_t_16;
2163  Py_ssize_t __pyx_t_17;
2164  int __pyx_lineno = 0;
2165  const char *__pyx_filename = NULL;
2166  int __pyx_clineno = 0;
2167  __Pyx_RefNannySetupContext("setElementBoundariesArray", 0);
2168  __pyx_pybuffer_elementBoundaryElementsArray.pybuffer.buf = NULL;
2169  __pyx_pybuffer_elementBoundaryElementsArray.refcount = 0;
2170  __pyx_pybuffernd_elementBoundaryElementsArray.data = NULL;
2171  __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer = &__pyx_pybuffer_elementBoundaryElementsArray;
2172  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
2173  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
2174  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
2175  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
2176  __pyx_pybuffer_elementBoundaryMaterialTypes.pybuffer.buf = NULL;
2177  __pyx_pybuffer_elementBoundaryMaterialTypes.refcount = 0;
2178  __pyx_pybuffernd_elementBoundaryMaterialTypes.data = NULL;
2179  __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryMaterialTypes;
2180  {
2181  __Pyx_BufFmt_StackElem __pyx_stack[1];
2182  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryElementsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2183  }
2184  __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.shape[1];
2185  {
2186  __Pyx_BufFmt_StackElem __pyx_stack[1];
2187  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2188  }
2189  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
2190  {
2191  __Pyx_BufFmt_StackElem __pyx_stack[1];
2192  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2193  }
2194  __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.shape[1];
2195 
2196  /* "subsurfaceTransportFunctions.pyx":34
2197  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryMaterialTypes):
2198  * cdef int ebN,eN_left,eN_right
2199  * for ebN in range(nElementBoundaries_global): # <<<<<<<<<<<<<<
2200  * eN_left = elementBoundaryElementsArray[ebN,0]
2201  * eN_right= elementBoundaryElementsArray[ebN,1]
2202  */
2203  __pyx_t_1 = __pyx_v_nElementBoundaries_global;
2204  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
2205  __pyx_v_ebN = __pyx_t_2;
2206 
2207  /* "subsurfaceTransportFunctions.pyx":35
2208  * cdef int ebN,eN_left,eN_right
2209  * for ebN in range(nElementBoundaries_global):
2210  * eN_left = elementBoundaryElementsArray[ebN,0] # <<<<<<<<<<<<<<
2211  * eN_right= elementBoundaryElementsArray[ebN,1]
2212  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
2213  */
2214  __pyx_t_3 = __pyx_v_ebN;
2215  __pyx_t_4 = 0;
2216  __pyx_t_5 = -1;
2217  if (__pyx_t_3 < 0) {
2218  __pyx_t_3 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape;
2219  if (unlikely(__pyx_t_3 < 0)) __pyx_t_5 = 0;
2220  } else if (unlikely(__pyx_t_3 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape)) __pyx_t_5 = 0;
2221  if (__pyx_t_4 < 0) {
2222  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape;
2223  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 1;
2224  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape)) __pyx_t_5 = 1;
2225  if (unlikely(__pyx_t_5 != -1)) {
2226  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2227  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2228  }
2229  __pyx_v_eN_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides, __pyx_t_4, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides));
2230 
2231  /* "subsurfaceTransportFunctions.pyx":36
2232  * for ebN in range(nElementBoundaries_global):
2233  * eN_left = elementBoundaryElementsArray[ebN,0]
2234  * eN_right= elementBoundaryElementsArray[ebN,1] # <<<<<<<<<<<<<<
2235  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
2236  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
2237  */
2238  __pyx_t_6 = __pyx_v_ebN;
2239  __pyx_t_7 = 1;
2240  __pyx_t_5 = -1;
2241  if (__pyx_t_6 < 0) {
2242  __pyx_t_6 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape;
2243  if (unlikely(__pyx_t_6 < 0)) __pyx_t_5 = 0;
2244  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape)) __pyx_t_5 = 0;
2245  if (__pyx_t_7 < 0) {
2246  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape;
2247  if (unlikely(__pyx_t_7 < 0)) __pyx_t_5 = 1;
2248  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape)) __pyx_t_5 = 1;
2249  if (unlikely(__pyx_t_5 != -1)) {
2250  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2251  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2252  }
2253  __pyx_v_eN_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides));
2254 
2255  /* "subsurfaceTransportFunctions.pyx":37
2256  * eN_left = elementBoundaryElementsArray[ebN,0]
2257  * eN_right= elementBoundaryElementsArray[ebN,1]
2258  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left] # <<<<<<<<<<<<<<
2259  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
2260  * if eN_right >= 0:
2261  */
2262  __pyx_t_8 = __pyx_v_eN_left;
2263  __pyx_t_5 = -1;
2264  if (__pyx_t_8 < 0) {
2265  __pyx_t_8 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
2266  if (unlikely(__pyx_t_8 < 0)) __pyx_t_5 = 0;
2267  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
2268  if (unlikely(__pyx_t_5 != -1)) {
2269  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2270  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2271  }
2272  __pyx_t_9 = __pyx_v_ebN;
2273  __pyx_t_10 = 0;
2274  __pyx_t_5 = -1;
2275  if (__pyx_t_9 < 0) {
2276  __pyx_t_9 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape;
2277  if (unlikely(__pyx_t_9 < 0)) __pyx_t_5 = 0;
2278  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
2279  if (__pyx_t_10 < 0) {
2280  __pyx_t_10 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape;
2281  if (unlikely(__pyx_t_10 < 0)) __pyx_t_5 = 1;
2282  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape)) __pyx_t_5 = 1;
2283  if (unlikely(__pyx_t_5 != -1)) {
2284  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2285  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2286  }
2287  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
2288 
2289  /* "subsurfaceTransportFunctions.pyx":38
2290  * eN_right= elementBoundaryElementsArray[ebN,1]
2291  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
2292  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left] # <<<<<<<<<<<<<<
2293  * if eN_right >= 0:
2294  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_right]
2295  */
2296  __pyx_t_11 = __pyx_v_eN_left;
2297  __pyx_t_5 = -1;
2298  if (__pyx_t_11 < 0) {
2299  __pyx_t_11 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
2300  if (unlikely(__pyx_t_11 < 0)) __pyx_t_5 = 0;
2301  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
2302  if (unlikely(__pyx_t_5 != -1)) {
2303  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2304  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2305  }
2306  __pyx_t_12 = __pyx_v_ebN;
2307  __pyx_t_13 = 1;
2308  __pyx_t_5 = -1;
2309  if (__pyx_t_12 < 0) {
2310  __pyx_t_12 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape;
2311  if (unlikely(__pyx_t_12 < 0)) __pyx_t_5 = 0;
2312  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
2313  if (__pyx_t_13 < 0) {
2314  __pyx_t_13 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape;
2315  if (unlikely(__pyx_t_13 < 0)) __pyx_t_5 = 1;
2316  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape)) __pyx_t_5 = 1;
2317  if (unlikely(__pyx_t_5 != -1)) {
2318  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2319  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2320  }
2321  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
2322 
2323  /* "subsurfaceTransportFunctions.pyx":39
2324  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
2325  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
2326  * if eN_right >= 0: # <<<<<<<<<<<<<<
2327  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_right]
2328  *
2329  */
2330  __pyx_t_14 = ((__pyx_v_eN_right >= 0) != 0);
2331  if (__pyx_t_14) {
2332 
2333  /* "subsurfaceTransportFunctions.pyx":40
2334  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
2335  * if eN_right >= 0:
2336  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_right] # <<<<<<<<<<<<<<
2337  *
2338  * ###
2339  */
2340  __pyx_t_15 = __pyx_v_eN_right;
2341  __pyx_t_5 = -1;
2342  if (__pyx_t_15 < 0) {
2343  __pyx_t_15 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
2344  if (unlikely(__pyx_t_15 < 0)) __pyx_t_5 = 0;
2345  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
2346  if (unlikely(__pyx_t_5 != -1)) {
2347  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2348  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2349  }
2350  __pyx_t_16 = __pyx_v_ebN;
2351  __pyx_t_17 = 1;
2352  __pyx_t_5 = -1;
2353  if (__pyx_t_16 < 0) {
2354  __pyx_t_16 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape;
2355  if (unlikely(__pyx_t_16 < 0)) __pyx_t_5 = 0;
2356  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
2357  if (__pyx_t_17 < 0) {
2358  __pyx_t_17 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape;
2359  if (unlikely(__pyx_t_17 < 0)) __pyx_t_5 = 1;
2360  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape)) __pyx_t_5 = 1;
2361  if (unlikely(__pyx_t_5 != -1)) {
2362  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2363  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2364  }
2365  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
2366 
2367  /* "subsurfaceTransportFunctions.pyx":39
2368  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
2369  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
2370  * if eN_right >= 0: # <<<<<<<<<<<<<<
2371  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_right]
2372  *
2373  */
2374  }
2375  }
2376 
2377  /* "subsurfaceTransportFunctions.pyx":29
2378  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
2379  *
2380  * def setElementBoundariesArray(int nElementBoundaries_global, # <<<<<<<<<<<<<<
2381  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
2382  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
2383  */
2384 
2385  /* function exit code */
2386  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2387  goto __pyx_L0;
2388  __pyx_L1_error:;
2389  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
2390  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
2391  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer);
2392  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer);
2393  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
2394  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
2395  __Pyx_AddTraceback("subsurfaceTransportFunctions.setElementBoundariesArray", __pyx_clineno, __pyx_lineno, __pyx_filename);
2396  __pyx_r = NULL;
2397  goto __pyx_L2;
2398  __pyx_L0:;
2399  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer);
2400  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer);
2401  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
2402  __pyx_L2:;
2403  __Pyx_XGIVEREF(__pyx_r);
2404  __Pyx_RefNannyFinishContext();
2405  return __pyx_r;
2406 }
2407 
2408 /* "subsurfaceTransportFunctions.pyx":43
2409  *
2410  * ###
2411  * def setScalarMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
2412  * numpy.ndarray[DTYPE_t,ndim=2] q_vals,
2413  * dict material_functions):
2414  */
2415 
2416 /* Python wrapper */
2417 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2418 static char __pyx_doc_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements[] = "\n loop over quadrature array and set is material j\n likely little improvement right now without correct typing of material_functions\n ";
2419 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements = {"setScalarMaterialFunctionOverElements", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements};
2420 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2421  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
2422  PyArrayObject *__pyx_v_q_vals = 0;
2423  PyObject *__pyx_v_material_functions = 0;
2424  int __pyx_lineno = 0;
2425  const char *__pyx_filename = NULL;
2426  int __pyx_clineno = 0;
2427  PyObject *__pyx_r = 0;
2428  __Pyx_RefNannyDeclarations
2429  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverElements (wrapper)", 0);
2430  {
2431  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_q_vals,&__pyx_n_s_material_functions,0};
2432  PyObject* values[3] = {0,0,0};
2433  if (unlikely(__pyx_kwds)) {
2434  Py_ssize_t kw_args;
2435  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2436  switch (pos_args) {
2437  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2438  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2439  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2440  case 0: break;
2441  default: goto __pyx_L5_argtuple_error;
2442  }
2443  kw_args = PyDict_Size(__pyx_kwds);
2444  switch (pos_args) {
2445  case 0:
2446  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
2447  else goto __pyx_L5_argtuple_error;
2448  case 1:
2449  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_vals)) != 0)) kw_args--;
2450  else {
2451  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElements", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2452  }
2453  case 2:
2454  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
2455  else {
2456  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElements", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2457  }
2458  }
2459  if (unlikely(kw_args > 0)) {
2460  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setScalarMaterialFunctionOverElements") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2461  }
2462  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
2463  goto __pyx_L5_argtuple_error;
2464  } else {
2465  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2466  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2467  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2468  }
2469  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[0]);
2470  __pyx_v_q_vals = ((PyArrayObject *)values[1]);
2471  __pyx_v_material_functions = ((PyObject*)values[2]);
2472  }
2473  goto __pyx_L4_argument_unpacking_done;
2474  __pyx_L5_argtuple_error:;
2475  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElements", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2476  __pyx_L3_error:;
2477  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
2478  __Pyx_RefNannyFinishContext();
2479  return NULL;
2480  __pyx_L4_argument_unpacking_done:;
2481  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2482  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_vals), __pyx_ptype_5numpy_ndarray, 1, "q_vals", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2483  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2484  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements(__pyx_self, __pyx_v_elementMaterialTypes, __pyx_v_q_vals, __pyx_v_material_functions);
2485 
2486  /* function exit code */
2487  goto __pyx_L0;
2488  __pyx_L1_error:;
2489  __pyx_r = NULL;
2490  __pyx_L0:;
2491  __Pyx_RefNannyFinishContext();
2492  return __pyx_r;
2493 }
2494 
2495 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions) {
2496  int __pyx_v_eN;
2497  int __pyx_v_k;
2498  int __pyx_v_material;
2499  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
2500  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
2501  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_vals;
2502  __Pyx_Buffer __pyx_pybuffer_q_vals;
2503  PyObject *__pyx_r = NULL;
2504  __Pyx_RefNannyDeclarations
2505  npy_intp __pyx_t_1;
2506  int __pyx_t_2;
2507  Py_ssize_t __pyx_t_3;
2508  int __pyx_t_4;
2509  npy_intp __pyx_t_5;
2510  PyObject *__pyx_t_6 = NULL;
2511  PyObject *__pyx_t_7 = NULL;
2512  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_8;
2513  Py_ssize_t __pyx_t_9;
2514  Py_ssize_t __pyx_t_10;
2515  int __pyx_t_11;
2516  int __pyx_lineno = 0;
2517  const char *__pyx_filename = NULL;
2518  int __pyx_clineno = 0;
2519  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverElements", 0);
2520  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
2521  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
2522  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
2523  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
2524  __pyx_pybuffer_q_vals.pybuffer.buf = NULL;
2525  __pyx_pybuffer_q_vals.refcount = 0;
2526  __pyx_pybuffernd_q_vals.data = NULL;
2527  __pyx_pybuffernd_q_vals.rcbuffer = &__pyx_pybuffer_q_vals;
2528  {
2529  __Pyx_BufFmt_StackElem __pyx_stack[1];
2530  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2531  }
2532  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
2533  {
2534  __Pyx_BufFmt_StackElem __pyx_stack[1];
2535  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2536  }
2537  __pyx_pybuffernd_q_vals.diminfo[0].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_vals.diminfo[0].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_vals.diminfo[1].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_vals.diminfo[1].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[1];
2538 
2539  /* "subsurfaceTransportFunctions.pyx":51
2540  * """
2541  * cdef int eN,k,material
2542  * for eN in range(q_vals.shape[0]): # <<<<<<<<<<<<<<
2543  * material = elementMaterialTypes[eN]
2544  * for k in range(q_vals.shape[1]):
2545  */
2546  __pyx_t_1 = (__pyx_v_q_vals->dimensions[0]);
2547  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
2548  __pyx_v_eN = __pyx_t_2;
2549 
2550  /* "subsurfaceTransportFunctions.pyx":52
2551  * cdef int eN,k,material
2552  * for eN in range(q_vals.shape[0]):
2553  * material = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
2554  * for k in range(q_vals.shape[1]):
2555  * q_vals[eN,k] = material_functions[material]
2556  */
2557  __pyx_t_3 = __pyx_v_eN;
2558  __pyx_t_4 = -1;
2559  if (__pyx_t_3 < 0) {
2560  __pyx_t_3 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
2561  if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 0;
2562  } else if (unlikely(__pyx_t_3 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_4 = 0;
2563  if (unlikely(__pyx_t_4 != -1)) {
2564  __Pyx_RaiseBufferIndexError(__pyx_t_4);
2565  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2566  }
2567  __pyx_v_material = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
2568 
2569  /* "subsurfaceTransportFunctions.pyx":53
2570  * for eN in range(q_vals.shape[0]):
2571  * material = elementMaterialTypes[eN]
2572  * for k in range(q_vals.shape[1]): # <<<<<<<<<<<<<<
2573  * q_vals[eN,k] = material_functions[material]
2574  *
2575  */
2576  __pyx_t_5 = (__pyx_v_q_vals->dimensions[1]);
2577  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_5; __pyx_t_4+=1) {
2578  __pyx_v_k = __pyx_t_4;
2579 
2580  /* "subsurfaceTransportFunctions.pyx":54
2581  * material = elementMaterialTypes[eN]
2582  * for k in range(q_vals.shape[1]):
2583  * q_vals[eN,k] = material_functions[material] # <<<<<<<<<<<<<<
2584  *
2585  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
2586  */
2587  if (unlikely(__pyx_v_material_functions == Py_None)) {
2588  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
2589  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2590  }
2591  __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_material); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2592  __Pyx_GOTREF(__pyx_t_6);
2593  __pyx_t_7 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_6); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
2594  __Pyx_GOTREF(__pyx_t_7);
2595  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2596  __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_8 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2597  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2598  __pyx_t_9 = __pyx_v_eN;
2599  __pyx_t_10 = __pyx_v_k;
2600  __pyx_t_11 = -1;
2601  if (__pyx_t_9 < 0) {
2602  __pyx_t_9 += __pyx_pybuffernd_q_vals.diminfo[0].shape;
2603  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 0;
2604  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_q_vals.diminfo[0].shape)) __pyx_t_11 = 0;
2605  if (__pyx_t_10 < 0) {
2606  __pyx_t_10 += __pyx_pybuffernd_q_vals.diminfo[1].shape;
2607  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 1;
2608  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_q_vals.diminfo[1].shape)) __pyx_t_11 = 1;
2609  if (unlikely(__pyx_t_11 != -1)) {
2610  __Pyx_RaiseBufferIndexError(__pyx_t_11);
2611  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2612  }
2613  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_q_vals.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_q_vals.diminfo[1].strides) = __pyx_t_8;
2614  }
2615  }
2616 
2617  /* "subsurfaceTransportFunctions.pyx":43
2618  *
2619  * ###
2620  * def setScalarMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
2621  * numpy.ndarray[DTYPE_t,ndim=2] q_vals,
2622  * dict material_functions):
2623  */
2624 
2625  /* function exit code */
2626  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2627  goto __pyx_L0;
2628  __pyx_L1_error:;
2629  __Pyx_XDECREF(__pyx_t_6);
2630  __Pyx_XDECREF(__pyx_t_7);
2631  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
2632  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
2633  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
2634  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
2635  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
2636  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
2637  __pyx_r = NULL;
2638  goto __pyx_L2;
2639  __pyx_L0:;
2640  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
2641  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
2642  __pyx_L2:;
2643  __Pyx_XGIVEREF(__pyx_r);
2644  __Pyx_RefNannyFinishContext();
2645  return __pyx_r;
2646 }
2647 
2648 /* "subsurfaceTransportFunctions.pyx":56
2649  * q_vals[eN,k] = material_functions[material]
2650  *
2651  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
2652  * numpy.ndarray[DTYPE_t,ndim=3] q_vals,
2653  * dict material_functions):
2654  */
2655 
2656 /* Python wrapper */
2657 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2658 static char __pyx_doc_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements[] = "\n loop over quadrature array and set \013ec f_j assuming element is material j\n ";
2659 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements = {"setVectorMaterialFunctionOverElements", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements};
2660 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2661  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
2662  PyArrayObject *__pyx_v_q_vals = 0;
2663  PyObject *__pyx_v_material_functions = 0;
2664  int __pyx_lineno = 0;
2665  const char *__pyx_filename = NULL;
2666  int __pyx_clineno = 0;
2667  PyObject *__pyx_r = 0;
2668  __Pyx_RefNannyDeclarations
2669  __Pyx_RefNannySetupContext("setVectorMaterialFunctionOverElements (wrapper)", 0);
2670  {
2671  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_q_vals,&__pyx_n_s_material_functions,0};
2672  PyObject* values[3] = {0,0,0};
2673  if (unlikely(__pyx_kwds)) {
2674  Py_ssize_t kw_args;
2675  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2676  switch (pos_args) {
2677  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2678  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2679  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2680  case 0: break;
2681  default: goto __pyx_L5_argtuple_error;
2682  }
2683  kw_args = PyDict_Size(__pyx_kwds);
2684  switch (pos_args) {
2685  case 0:
2686  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
2687  else goto __pyx_L5_argtuple_error;
2688  case 1:
2689  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_vals)) != 0)) kw_args--;
2690  else {
2691  __Pyx_RaiseArgtupleInvalid("setVectorMaterialFunctionOverElements", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2692  }
2693  case 2:
2694  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
2695  else {
2696  __Pyx_RaiseArgtupleInvalid("setVectorMaterialFunctionOverElements", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2697  }
2698  }
2699  if (unlikely(kw_args > 0)) {
2700  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setVectorMaterialFunctionOverElements") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2701  }
2702  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
2703  goto __pyx_L5_argtuple_error;
2704  } else {
2705  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2706  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2707  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2708  }
2709  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[0]);
2710  __pyx_v_q_vals = ((PyArrayObject *)values[1]);
2711  __pyx_v_material_functions = ((PyObject*)values[2]);
2712  }
2713  goto __pyx_L4_argument_unpacking_done;
2714  __pyx_L5_argtuple_error:;
2715  __Pyx_RaiseArgtupleInvalid("setVectorMaterialFunctionOverElements", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2716  __pyx_L3_error:;
2717  __Pyx_AddTraceback("subsurfaceTransportFunctions.setVectorMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
2718  __Pyx_RefNannyFinishContext();
2719  return NULL;
2720  __pyx_L4_argument_unpacking_done:;
2721  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2722  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_vals), __pyx_ptype_5numpy_ndarray, 1, "q_vals", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2723  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2724  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements(__pyx_self, __pyx_v_elementMaterialTypes, __pyx_v_q_vals, __pyx_v_material_functions);
2725 
2726  /* function exit code */
2727  goto __pyx_L0;
2728  __pyx_L1_error:;
2729  __pyx_r = NULL;
2730  __pyx_L0:;
2731  __Pyx_RefNannyFinishContext();
2732  return __pyx_r;
2733 }
2734 
2735 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions) {
2736  int __pyx_v_eN;
2737  int __pyx_v_k;
2738  int __pyx_v_material;
2739  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
2740  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
2741  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_vals;
2742  __Pyx_Buffer __pyx_pybuffer_q_vals;
2743  PyObject *__pyx_r = NULL;
2744  __Pyx_RefNannyDeclarations
2745  npy_intp __pyx_t_1;
2746  int __pyx_t_2;
2747  Py_ssize_t __pyx_t_3;
2748  int __pyx_t_4;
2749  npy_intp __pyx_t_5;
2750  PyObject *__pyx_t_6 = NULL;
2751  PyObject *__pyx_t_7 = NULL;
2752  PyObject *__pyx_t_8 = NULL;
2753  PyObject *__pyx_t_9 = NULL;
2754  int __pyx_lineno = 0;
2755  const char *__pyx_filename = NULL;
2756  int __pyx_clineno = 0;
2757  __Pyx_RefNannySetupContext("setVectorMaterialFunctionOverElements", 0);
2758  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
2759  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
2760  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
2761  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
2762  __pyx_pybuffer_q_vals.pybuffer.buf = NULL;
2763  __pyx_pybuffer_q_vals.refcount = 0;
2764  __pyx_pybuffernd_q_vals.data = NULL;
2765  __pyx_pybuffernd_q_vals.rcbuffer = &__pyx_pybuffer_q_vals;
2766  {
2767  __Pyx_BufFmt_StackElem __pyx_stack[1];
2768  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2769  }
2770  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
2771  {
2772  __Pyx_BufFmt_StackElem __pyx_stack[1];
2773  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2774  }
2775  __pyx_pybuffernd_q_vals.diminfo[0].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_vals.diminfo[0].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_vals.diminfo[1].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_vals.diminfo[1].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_vals.diminfo[2].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_vals.diminfo[2].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[2];
2776 
2777  /* "subsurfaceTransportFunctions.pyx":63
2778  * """
2779  * cdef int eN,k,material
2780  * for eN in range(q_vals.shape[0]): # <<<<<<<<<<<<<<
2781  * material = elementMaterialTypes[eN]
2782  * for k in range(q_vals.shape[1]):
2783  */
2784  __pyx_t_1 = (__pyx_v_q_vals->dimensions[0]);
2785  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
2786  __pyx_v_eN = __pyx_t_2;
2787 
2788  /* "subsurfaceTransportFunctions.pyx":64
2789  * cdef int eN,k,material
2790  * for eN in range(q_vals.shape[0]):
2791  * material = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
2792  * for k in range(q_vals.shape[1]):
2793  * q_vals[eN,k,:] = material_functions[material].flat
2794  */
2795  __pyx_t_3 = __pyx_v_eN;
2796  __pyx_t_4 = -1;
2797  if (__pyx_t_3 < 0) {
2798  __pyx_t_3 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
2799  if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 0;
2800  } else if (unlikely(__pyx_t_3 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_4 = 0;
2801  if (unlikely(__pyx_t_4 != -1)) {
2802  __Pyx_RaiseBufferIndexError(__pyx_t_4);
2803  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2804  }
2805  __pyx_v_material = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
2806 
2807  /* "subsurfaceTransportFunctions.pyx":65
2808  * for eN in range(q_vals.shape[0]):
2809  * material = elementMaterialTypes[eN]
2810  * for k in range(q_vals.shape[1]): # <<<<<<<<<<<<<<
2811  * q_vals[eN,k,:] = material_functions[material].flat
2812  *
2813  */
2814  __pyx_t_5 = (__pyx_v_q_vals->dimensions[1]);
2815  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_5; __pyx_t_4+=1) {
2816  __pyx_v_k = __pyx_t_4;
2817 
2818  /* "subsurfaceTransportFunctions.pyx":66
2819  * material = elementMaterialTypes[eN]
2820  * for k in range(q_vals.shape[1]):
2821  * q_vals[eN,k,:] = material_functions[material].flat # <<<<<<<<<<<<<<
2822  *
2823  *
2824  */
2825  if (unlikely(__pyx_v_material_functions == Py_None)) {
2826  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
2827  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2828  }
2829  __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_material); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2830  __Pyx_GOTREF(__pyx_t_6);
2831  __pyx_t_7 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_6); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
2832  __Pyx_GOTREF(__pyx_t_7);
2833  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2834  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_flat); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2835  __Pyx_GOTREF(__pyx_t_6);
2836  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2837  __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2838  __Pyx_GOTREF(__pyx_t_7);
2839  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2840  __Pyx_GOTREF(__pyx_t_8);
2841  __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2842  __Pyx_GOTREF(__pyx_t_9);
2843  __Pyx_GIVEREF(__pyx_t_7);
2844  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7);
2845  __Pyx_GIVEREF(__pyx_t_8);
2846  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8);
2847  __Pyx_INCREF(__pyx_slice_);
2848  __Pyx_GIVEREF(__pyx_slice_);
2849  PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_slice_);
2850  __pyx_t_7 = 0;
2851  __pyx_t_8 = 0;
2852  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_q_vals), __pyx_t_9, __pyx_t_6) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2853  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
2854  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2855  }
2856  }
2857 
2858  /* "subsurfaceTransportFunctions.pyx":56
2859  * q_vals[eN,k] = material_functions[material]
2860  *
2861  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
2862  * numpy.ndarray[DTYPE_t,ndim=3] q_vals,
2863  * dict material_functions):
2864  */
2865 
2866  /* function exit code */
2867  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2868  goto __pyx_L0;
2869  __pyx_L1_error:;
2870  __Pyx_XDECREF(__pyx_t_6);
2871  __Pyx_XDECREF(__pyx_t_7);
2872  __Pyx_XDECREF(__pyx_t_8);
2873  __Pyx_XDECREF(__pyx_t_9);
2874  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
2875  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
2876  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
2877  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
2878  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
2879  __Pyx_AddTraceback("subsurfaceTransportFunctions.setVectorMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
2880  __pyx_r = NULL;
2881  goto __pyx_L2;
2882  __pyx_L0:;
2883  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
2884  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
2885  __pyx_L2:;
2886  __Pyx_XGIVEREF(__pyx_r);
2887  __Pyx_RefNannyFinishContext();
2888  return __pyx_r;
2889 }
2890 
2891 /* "subsurfaceTransportFunctions.pyx":69
2892  *
2893  *
2894  * def setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
2895  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
2896  * numpy.ndarray[DTYPE_t,ndim=3] ebq_vals,
2897  */
2898 
2899 /* Python wrapper */
2900 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2901 static char __pyx_doc_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage[] = "\n loop over quadrature array and set f = 0.5(f^L_j+f^R_k) assuming element on left \n is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
2902 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage = {"setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage};
2903 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2904  PyArrayObject *__pyx_v_elementBoundariesArray = 0;
2905  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
2906  PyArrayObject *__pyx_v_ebq_vals = 0;
2907  PyObject *__pyx_v_material_functions = 0;
2908  int __pyx_lineno = 0;
2909  const char *__pyx_filename = NULL;
2910  int __pyx_clineno = 0;
2911  PyObject *__pyx_r = 0;
2912  __Pyx_RefNannyDeclarations
2913  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage (wrapper)", 0);
2914  {
2915  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_ebq_vals,&__pyx_n_s_material_functions,0};
2916  PyObject* values[4] = {0,0,0,0};
2917  if (unlikely(__pyx_kwds)) {
2918  Py_ssize_t kw_args;
2919  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2920  switch (pos_args) {
2921  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2922  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2923  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2924  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2925  case 0: break;
2926  default: goto __pyx_L5_argtuple_error;
2927  }
2928  kw_args = PyDict_Size(__pyx_kwds);
2929  switch (pos_args) {
2930  case 0:
2931  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
2932  else goto __pyx_L5_argtuple_error;
2933  case 1:
2934  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
2935  else {
2936  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2937  }
2938  case 2:
2939  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ebq_vals)) != 0)) kw_args--;
2940  else {
2941  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2942  }
2943  case 3:
2944  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
2945  else {
2946  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2947  }
2948  }
2949  if (unlikely(kw_args > 0)) {
2950  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2951  }
2952  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
2953  goto __pyx_L5_argtuple_error;
2954  } else {
2955  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2956  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2957  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2958  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2959  }
2960  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[0]);
2961  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[1]);
2962  __pyx_v_ebq_vals = ((PyArrayObject *)values[2]);
2963  __pyx_v_material_functions = ((PyObject*)values[3]);
2964  }
2965  goto __pyx_L4_argument_unpacking_done;
2966  __pyx_L5_argtuple_error:;
2967  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2968  __pyx_L3_error:;
2969  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
2970  __Pyx_RefNannyFinishContext();
2971  return NULL;
2972  __pyx_L4_argument_unpacking_done:;
2973  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2974  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2975  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_vals", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2976  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2977  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(__pyx_self, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_ebq_vals, __pyx_v_material_functions);
2978 
2979  /* function exit code */
2980  goto __pyx_L0;
2981  __pyx_L1_error:;
2982  __pyx_r = NULL;
2983  __pyx_L0:;
2984  __Pyx_RefNannyFinishContext();
2985  return __pyx_r;
2986 }
2987 
2988 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions) {
2989  int __pyx_v_eN;
2990  int __pyx_v_ebN;
2991  int __pyx_v_ebN_local;
2992  int __pyx_v_k;
2993  int __pyx_v_material_left;
2994  int __pyx_v_material_right;
2995  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_vals;
2996  __Pyx_Buffer __pyx_pybuffer_ebq_vals;
2997  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
2998  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
2999  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
3000  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
3001  PyObject *__pyx_r = NULL;
3002  __Pyx_RefNannyDeclarations
3003  npy_intp __pyx_t_1;
3004  int __pyx_t_2;
3005  npy_intp __pyx_t_3;
3006  int __pyx_t_4;
3007  Py_ssize_t __pyx_t_5;
3008  Py_ssize_t __pyx_t_6;
3009  int __pyx_t_7;
3010  Py_ssize_t __pyx_t_8;
3011  Py_ssize_t __pyx_t_9;
3012  Py_ssize_t __pyx_t_10;
3013  Py_ssize_t __pyx_t_11;
3014  npy_intp __pyx_t_12;
3015  PyObject *__pyx_t_13 = NULL;
3016  PyObject *__pyx_t_14 = NULL;
3017  PyObject *__pyx_t_15 = NULL;
3018  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_16;
3019  Py_ssize_t __pyx_t_17;
3020  Py_ssize_t __pyx_t_18;
3021  Py_ssize_t __pyx_t_19;
3022  int __pyx_t_20;
3023  int __pyx_lineno = 0;
3024  const char *__pyx_filename = NULL;
3025  int __pyx_clineno = 0;
3026  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 0);
3027  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
3028  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
3029  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
3030  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
3031  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
3032  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
3033  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
3034  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
3035  __pyx_pybuffer_ebq_vals.pybuffer.buf = NULL;
3036  __pyx_pybuffer_ebq_vals.refcount = 0;
3037  __pyx_pybuffernd_ebq_vals.data = NULL;
3038  __pyx_pybuffernd_ebq_vals.rcbuffer = &__pyx_pybuffer_ebq_vals;
3039  {
3040  __Pyx_BufFmt_StackElem __pyx_stack[1];
3041  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3042  }
3043  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
3044  {
3045  __Pyx_BufFmt_StackElem __pyx_stack[1];
3046  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3047  }
3048  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
3049  {
3050  __Pyx_BufFmt_StackElem __pyx_stack[1];
3051  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3052  }
3053  __pyx_pybuffernd_ebq_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[2];
3054 
3055  /* "subsurfaceTransportFunctions.pyx":82
3056  * cdef int eN,ebN,ebN_local,k,material_left,material_right
3057  *
3058  * for eN in range(ebq_vals.shape[0]): # <<<<<<<<<<<<<<
3059  * for ebN_local in range(ebq_vals.shape[1]):
3060  * ebN = elementBoundariesArray[eN,ebN_local]
3061  */
3062  __pyx_t_1 = (__pyx_v_ebq_vals->dimensions[0]);
3063  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
3064  __pyx_v_eN = __pyx_t_2;
3065 
3066  /* "subsurfaceTransportFunctions.pyx":83
3067  *
3068  * for eN in range(ebq_vals.shape[0]):
3069  * for ebN_local in range(ebq_vals.shape[1]): # <<<<<<<<<<<<<<
3070  * ebN = elementBoundariesArray[eN,ebN_local]
3071  * material_left = elementBoundaryTypes[ebN,0]
3072  */
3073  __pyx_t_3 = (__pyx_v_ebq_vals->dimensions[1]);
3074  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
3075  __pyx_v_ebN_local = __pyx_t_4;
3076 
3077  /* "subsurfaceTransportFunctions.pyx":84
3078  * for eN in range(ebq_vals.shape[0]):
3079  * for ebN_local in range(ebq_vals.shape[1]):
3080  * ebN = elementBoundariesArray[eN,ebN_local] # <<<<<<<<<<<<<<
3081  * material_left = elementBoundaryTypes[ebN,0]
3082  * material_right= elementBoundaryTypes[ebN,1]
3083  */
3084  __pyx_t_5 = __pyx_v_eN;
3085  __pyx_t_6 = __pyx_v_ebN_local;
3086  __pyx_t_7 = -1;
3087  if (__pyx_t_5 < 0) {
3088  __pyx_t_5 += __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape;
3089  if (unlikely(__pyx_t_5 < 0)) __pyx_t_7 = 0;
3090  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape)) __pyx_t_7 = 0;
3091  if (__pyx_t_6 < 0) {
3092  __pyx_t_6 += __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape;
3093  if (unlikely(__pyx_t_6 < 0)) __pyx_t_7 = 1;
3094  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape)) __pyx_t_7 = 1;
3095  if (unlikely(__pyx_t_7 != -1)) {
3096  __Pyx_RaiseBufferIndexError(__pyx_t_7);
3097  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3098  }
3099  __pyx_v_ebN = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides));
3100 
3101  /* "subsurfaceTransportFunctions.pyx":85
3102  * for ebN_local in range(ebq_vals.shape[1]):
3103  * ebN = elementBoundariesArray[eN,ebN_local]
3104  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
3105  * material_right= elementBoundaryTypes[ebN,1]
3106  * for k in range(ebq_vals.shape[2]):
3107  */
3108  __pyx_t_8 = __pyx_v_ebN;
3109  __pyx_t_9 = 0;
3110  __pyx_t_7 = -1;
3111  if (__pyx_t_8 < 0) {
3112  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
3113  if (unlikely(__pyx_t_8 < 0)) __pyx_t_7 = 0;
3114  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_7 = 0;
3115  if (__pyx_t_9 < 0) {
3116  __pyx_t_9 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
3117  if (unlikely(__pyx_t_9 < 0)) __pyx_t_7 = 1;
3118  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_7 = 1;
3119  if (unlikely(__pyx_t_7 != -1)) {
3120  __Pyx_RaiseBufferIndexError(__pyx_t_7);
3121  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3122  }
3123  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
3124 
3125  /* "subsurfaceTransportFunctions.pyx":86
3126  * ebN = elementBoundariesArray[eN,ebN_local]
3127  * material_left = elementBoundaryTypes[ebN,0]
3128  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
3129  * for k in range(ebq_vals.shape[2]):
3130  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+
3131  */
3132  __pyx_t_10 = __pyx_v_ebN;
3133  __pyx_t_11 = 1;
3134  __pyx_t_7 = -1;
3135  if (__pyx_t_10 < 0) {
3136  __pyx_t_10 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
3137  if (unlikely(__pyx_t_10 < 0)) __pyx_t_7 = 0;
3138  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_7 = 0;
3139  if (__pyx_t_11 < 0) {
3140  __pyx_t_11 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
3141  if (unlikely(__pyx_t_11 < 0)) __pyx_t_7 = 1;
3142  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_7 = 1;
3143  if (unlikely(__pyx_t_7 != -1)) {
3144  __Pyx_RaiseBufferIndexError(__pyx_t_7);
3145  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3146  }
3147  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
3148 
3149  /* "subsurfaceTransportFunctions.pyx":87
3150  * material_left = elementBoundaryTypes[ebN,0]
3151  * material_right= elementBoundaryTypes[ebN,1]
3152  * for k in range(ebq_vals.shape[2]): # <<<<<<<<<<<<<<
3153  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+
3154  * material_functions[material_right])
3155  */
3156  __pyx_t_12 = (__pyx_v_ebq_vals->dimensions[2]);
3157  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_12; __pyx_t_7+=1) {
3158  __pyx_v_k = __pyx_t_7;
3159 
3160  /* "subsurfaceTransportFunctions.pyx":88
3161  * material_right= elementBoundaryTypes[ebN,1]
3162  * for k in range(ebq_vals.shape[2]):
3163  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+ # <<<<<<<<<<<<<<
3164  * material_functions[material_right])
3165  *
3166  */
3167  if (unlikely(__pyx_v_material_functions == Py_None)) {
3168  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3169  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3170  }
3171  __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3172  __Pyx_GOTREF(__pyx_t_13);
3173  __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_13); if (unlikely(__pyx_t_14 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
3174  __Pyx_GOTREF(__pyx_t_14);
3175  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
3176 
3177  /* "subsurfaceTransportFunctions.pyx":89
3178  * for k in range(ebq_vals.shape[2]):
3179  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+
3180  * material_functions[material_right]) # <<<<<<<<<<<<<<
3181  *
3182  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd,
3183  */
3184  if (unlikely(__pyx_v_material_functions == Py_None)) {
3185  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3186  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3187  }
3188  __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3189  __Pyx_GOTREF(__pyx_t_13);
3190  __pyx_t_15 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_13); if (unlikely(__pyx_t_15 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
3191  __Pyx_GOTREF(__pyx_t_15);
3192  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
3193 
3194  /* "subsurfaceTransportFunctions.pyx":88
3195  * material_right= elementBoundaryTypes[ebN,1]
3196  * for k in range(ebq_vals.shape[2]):
3197  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+ # <<<<<<<<<<<<<<
3198  * material_functions[material_right])
3199  *
3200  */
3201  __pyx_t_13 = PyNumber_Add(__pyx_t_14, __pyx_t_15); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3202  __Pyx_GOTREF(__pyx_t_13);
3203  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
3204  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
3205  __pyx_t_15 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_13); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3206  __Pyx_GOTREF(__pyx_t_15);
3207  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
3208  __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_t_15); if (unlikely((__pyx_t_16 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3209  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
3210  __pyx_t_17 = __pyx_v_eN;
3211  __pyx_t_18 = __pyx_v_ebN_local;
3212  __pyx_t_19 = __pyx_v_k;
3213  __pyx_t_20 = -1;
3214  if (__pyx_t_17 < 0) {
3215  __pyx_t_17 += __pyx_pybuffernd_ebq_vals.diminfo[0].shape;
3216  if (unlikely(__pyx_t_17 < 0)) __pyx_t_20 = 0;
3217  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_ebq_vals.diminfo[0].shape)) __pyx_t_20 = 0;
3218  if (__pyx_t_18 < 0) {
3219  __pyx_t_18 += __pyx_pybuffernd_ebq_vals.diminfo[1].shape;
3220  if (unlikely(__pyx_t_18 < 0)) __pyx_t_20 = 1;
3221  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_ebq_vals.diminfo[1].shape)) __pyx_t_20 = 1;
3222  if (__pyx_t_19 < 0) {
3223  __pyx_t_19 += __pyx_pybuffernd_ebq_vals.diminfo[2].shape;
3224  if (unlikely(__pyx_t_19 < 0)) __pyx_t_20 = 2;
3225  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_ebq_vals.diminfo[2].shape)) __pyx_t_20 = 2;
3226  if (unlikely(__pyx_t_20 != -1)) {
3227  __Pyx_RaiseBufferIndexError(__pyx_t_20);
3228  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3229  }
3230  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_ebq_vals.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_ebq_vals.diminfo[1].strides, __pyx_t_19, __pyx_pybuffernd_ebq_vals.diminfo[2].strides) = __pyx_t_16;
3231  }
3232  }
3233  }
3234 
3235  /* "subsurfaceTransportFunctions.pyx":69
3236  *
3237  *
3238  * def setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
3239  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
3240  * numpy.ndarray[DTYPE_t,ndim=3] ebq_vals,
3241  */
3242 
3243  /* function exit code */
3244  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3245  goto __pyx_L0;
3246  __pyx_L1_error:;
3247  __Pyx_XDECREF(__pyx_t_13);
3248  __Pyx_XDECREF(__pyx_t_14);
3249  __Pyx_XDECREF(__pyx_t_15);
3250  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3251  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3252  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
3253  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
3254  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
3255  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3256  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
3257  __pyx_r = NULL;
3258  goto __pyx_L2;
3259  __pyx_L0:;
3260  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
3261  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
3262  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
3263  __pyx_L2:;
3264  __Pyx_XGIVEREF(__pyx_r);
3265  __Pyx_RefNannyFinishContext();
3266  return __pyx_r;
3267 }
3268 
3269 /* "subsurfaceTransportFunctions.pyx":91
3270  * material_functions[material_right])
3271  *
3272  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
3273  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
3274  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
3275  */
3276 
3277 /* Python wrapper */
3278 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3279 static char __pyx_doc_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage[] = "\n loop over quadrature array and evaluate function \ten f_{mn} = f^L_{j,mn} f^R_{k,mn}/(f^L_{j,mn}+f^R_{k,mn})\n assuming element on left is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
3280 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage = {"setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage};
3281 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3282  int __pyx_v_nd;
3283  PyArrayObject *__pyx_v_elementBoundariesArray = 0;
3284  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
3285  PyArrayObject *__pyx_v_ebq_vals = 0;
3286  PyObject *__pyx_v_material_functions = 0;
3287  int __pyx_lineno = 0;
3288  const char *__pyx_filename = NULL;
3289  int __pyx_clineno = 0;
3290  PyObject *__pyx_r = 0;
3291  __Pyx_RefNannyDeclarations
3292  __Pyx_RefNannySetupContext("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage (wrapper)", 0);
3293  {
3294  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nd,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_ebq_vals,&__pyx_n_s_material_functions,0};
3295  PyObject* values[5] = {0,0,0,0,0};
3296  if (unlikely(__pyx_kwds)) {
3297  Py_ssize_t kw_args;
3298  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3299  switch (pos_args) {
3300  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3301  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3302  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3303  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3304  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3305  case 0: break;
3306  default: goto __pyx_L5_argtuple_error;
3307  }
3308  kw_args = PyDict_Size(__pyx_kwds);
3309  switch (pos_args) {
3310  case 0:
3311  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
3312  else goto __pyx_L5_argtuple_error;
3313  case 1:
3314  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
3315  else {
3316  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3317  }
3318  case 2:
3319  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
3320  else {
3321  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3322  }
3323  case 3:
3324  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ebq_vals)) != 0)) kw_args--;
3325  else {
3326  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3327  }
3328  case 4:
3329  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
3330  else {
3331  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3332  }
3333  }
3334  if (unlikely(kw_args > 0)) {
3335  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3336  }
3337  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
3338  goto __pyx_L5_argtuple_error;
3339  } else {
3340  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3341  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3342  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3343  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3344  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3345  }
3346  __pyx_v_nd = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3347  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[1]);
3348  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[2]);
3349  __pyx_v_ebq_vals = ((PyArrayObject *)values[3]);
3350  __pyx_v_material_functions = ((PyObject*)values[4]);
3351  }
3352  goto __pyx_L4_argument_unpacking_done;
3353  __pyx_L5_argtuple_error:;
3354  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3355  __pyx_L3_error:;
3356  __Pyx_AddTraceback("subsurfaceTransportFunctions.setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
3357  __Pyx_RefNannyFinishContext();
3358  return NULL;
3359  __pyx_L4_argument_unpacking_done:;
3360  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3361  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3362  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_vals", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3363  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3364  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(__pyx_self, __pyx_v_nd, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_ebq_vals, __pyx_v_material_functions);
3365 
3366  /* function exit code */
3367  goto __pyx_L0;
3368  __pyx_L1_error:;
3369  __pyx_r = NULL;
3370  __pyx_L0:;
3371  __Pyx_RefNannyFinishContext();
3372  return __pyx_r;
3373 }
3374 
3375 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions) {
3376  int __pyx_v_eN;
3377  int __pyx_v_ebN;
3378  int __pyx_v_ebN_local;
3379  int __pyx_v_k;
3380  int __pyx_v_material_left;
3381  int __pyx_v_material_right;
3382  int __pyx_v_I;
3383  int __pyx_v_J;
3384  double __pyx_v_numer;
3385  double __pyx_v_denom;
3386  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_vals;
3387  __Pyx_Buffer __pyx_pybuffer_ebq_vals;
3388  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
3389  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
3390  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
3391  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
3392  PyObject *__pyx_r = NULL;
3393  __Pyx_RefNannyDeclarations
3394  npy_intp __pyx_t_1;
3395  int __pyx_t_2;
3396  npy_intp __pyx_t_3;
3397  int __pyx_t_4;
3398  Py_ssize_t __pyx_t_5;
3399  Py_ssize_t __pyx_t_6;
3400  int __pyx_t_7;
3401  Py_ssize_t __pyx_t_8;
3402  Py_ssize_t __pyx_t_9;
3403  Py_ssize_t __pyx_t_10;
3404  Py_ssize_t __pyx_t_11;
3405  npy_intp __pyx_t_12;
3406  int __pyx_t_13;
3407  int __pyx_t_14;
3408  int __pyx_t_15;
3409  int __pyx_t_16;
3410  PyObject *__pyx_t_17 = NULL;
3411  PyObject *__pyx_t_18 = NULL;
3412  PyObject *__pyx_t_19 = NULL;
3413  PyObject *__pyx_t_20 = NULL;
3414  PyObject *__pyx_t_21 = NULL;
3415  double __pyx_t_22;
3416  Py_ssize_t __pyx_t_23;
3417  Py_ssize_t __pyx_t_24;
3418  Py_ssize_t __pyx_t_25;
3419  Py_ssize_t __pyx_t_26;
3420  int __pyx_t_27;
3421  int __pyx_lineno = 0;
3422  const char *__pyx_filename = NULL;
3423  int __pyx_clineno = 0;
3424  __Pyx_RefNannySetupContext("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 0);
3425  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
3426  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
3427  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
3428  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
3429  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
3430  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
3431  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
3432  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
3433  __pyx_pybuffer_ebq_vals.pybuffer.buf = NULL;
3434  __pyx_pybuffer_ebq_vals.refcount = 0;
3435  __pyx_pybuffernd_ebq_vals.data = NULL;
3436  __pyx_pybuffernd_ebq_vals.rcbuffer = &__pyx_pybuffer_ebq_vals;
3437  {
3438  __Pyx_BufFmt_StackElem __pyx_stack[1];
3439  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3440  }
3441  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
3442  {
3443  __Pyx_BufFmt_StackElem __pyx_stack[1];
3444  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3445  }
3446  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
3447  {
3448  __Pyx_BufFmt_StackElem __pyx_stack[1];
3449  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3450  }
3451  __pyx_pybuffernd_ebq_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_ebq_vals.diminfo[3].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_ebq_vals.diminfo[3].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[3];
3452 
3453  /* "subsurfaceTransportFunctions.pyx":106
3454  * cdef double numer,denom
3455  *
3456  * for eN in range(ebq_vals.shape[0]): # <<<<<<<<<<<<<<
3457  * for ebN_local in range(ebq_vals.shape[1]):
3458  * ebN = elementBoundariesArray[eN,ebN_local]
3459  */
3460  __pyx_t_1 = (__pyx_v_ebq_vals->dimensions[0]);
3461  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
3462  __pyx_v_eN = __pyx_t_2;
3463 
3464  /* "subsurfaceTransportFunctions.pyx":107
3465  *
3466  * for eN in range(ebq_vals.shape[0]):
3467  * for ebN_local in range(ebq_vals.shape[1]): # <<<<<<<<<<<<<<
3468  * ebN = elementBoundariesArray[eN,ebN_local]
3469  * material_left = elementBoundaryTypes[ebN,0]
3470  */
3471  __pyx_t_3 = (__pyx_v_ebq_vals->dimensions[1]);
3472  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
3473  __pyx_v_ebN_local = __pyx_t_4;
3474 
3475  /* "subsurfaceTransportFunctions.pyx":108
3476  * for eN in range(ebq_vals.shape[0]):
3477  * for ebN_local in range(ebq_vals.shape[1]):
3478  * ebN = elementBoundariesArray[eN,ebN_local] # <<<<<<<<<<<<<<
3479  * material_left = elementBoundaryTypes[ebN,0]
3480  * material_right= elementBoundaryTypes[ebN,1]
3481  */
3482  __pyx_t_5 = __pyx_v_eN;
3483  __pyx_t_6 = __pyx_v_ebN_local;
3484  __pyx_t_7 = -1;
3485  if (__pyx_t_5 < 0) {
3486  __pyx_t_5 += __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape;
3487  if (unlikely(__pyx_t_5 < 0)) __pyx_t_7 = 0;
3488  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape)) __pyx_t_7 = 0;
3489  if (__pyx_t_6 < 0) {
3490  __pyx_t_6 += __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape;
3491  if (unlikely(__pyx_t_6 < 0)) __pyx_t_7 = 1;
3492  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape)) __pyx_t_7 = 1;
3493  if (unlikely(__pyx_t_7 != -1)) {
3494  __Pyx_RaiseBufferIndexError(__pyx_t_7);
3495  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3496  }
3497  __pyx_v_ebN = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides));
3498 
3499  /* "subsurfaceTransportFunctions.pyx":109
3500  * for ebN_local in range(ebq_vals.shape[1]):
3501  * ebN = elementBoundariesArray[eN,ebN_local]
3502  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
3503  * material_right= elementBoundaryTypes[ebN,1]
3504  * for k in range(ebq_vals.shape[2]):
3505  */
3506  __pyx_t_8 = __pyx_v_ebN;
3507  __pyx_t_9 = 0;
3508  __pyx_t_7 = -1;
3509  if (__pyx_t_8 < 0) {
3510  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
3511  if (unlikely(__pyx_t_8 < 0)) __pyx_t_7 = 0;
3512  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_7 = 0;
3513  if (__pyx_t_9 < 0) {
3514  __pyx_t_9 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
3515  if (unlikely(__pyx_t_9 < 0)) __pyx_t_7 = 1;
3516  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_7 = 1;
3517  if (unlikely(__pyx_t_7 != -1)) {
3518  __Pyx_RaiseBufferIndexError(__pyx_t_7);
3519  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3520  }
3521  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
3522 
3523  /* "subsurfaceTransportFunctions.pyx":110
3524  * ebN = elementBoundariesArray[eN,ebN_local]
3525  * material_left = elementBoundaryTypes[ebN,0]
3526  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
3527  * for k in range(ebq_vals.shape[2]):
3528  * for I in range(nd):
3529  */
3530  __pyx_t_10 = __pyx_v_ebN;
3531  __pyx_t_11 = 1;
3532  __pyx_t_7 = -1;
3533  if (__pyx_t_10 < 0) {
3534  __pyx_t_10 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
3535  if (unlikely(__pyx_t_10 < 0)) __pyx_t_7 = 0;
3536  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_7 = 0;
3537  if (__pyx_t_11 < 0) {
3538  __pyx_t_11 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
3539  if (unlikely(__pyx_t_11 < 0)) __pyx_t_7 = 1;
3540  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_7 = 1;
3541  if (unlikely(__pyx_t_7 != -1)) {
3542  __Pyx_RaiseBufferIndexError(__pyx_t_7);
3543  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3544  }
3545  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
3546 
3547  /* "subsurfaceTransportFunctions.pyx":111
3548  * material_left = elementBoundaryTypes[ebN,0]
3549  * material_right= elementBoundaryTypes[ebN,1]
3550  * for k in range(ebq_vals.shape[2]): # <<<<<<<<<<<<<<
3551  * for I in range(nd):
3552  * for J in range(nd):
3553  */
3554  __pyx_t_12 = (__pyx_v_ebq_vals->dimensions[2]);
3555  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_12; __pyx_t_7+=1) {
3556  __pyx_v_k = __pyx_t_7;
3557 
3558  /* "subsurfaceTransportFunctions.pyx":112
3559  * material_right= elementBoundaryTypes[ebN,1]
3560  * for k in range(ebq_vals.shape[2]):
3561  * for I in range(nd): # <<<<<<<<<<<<<<
3562  * for J in range(nd):
3563  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
3564  */
3565  __pyx_t_13 = __pyx_v_nd;
3566  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
3567  __pyx_v_I = __pyx_t_14;
3568 
3569  /* "subsurfaceTransportFunctions.pyx":113
3570  * for k in range(ebq_vals.shape[2]):
3571  * for I in range(nd):
3572  * for J in range(nd): # <<<<<<<<<<<<<<
3573  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
3574  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
3575  */
3576  __pyx_t_15 = __pyx_v_nd;
3577  for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
3578  __pyx_v_J = __pyx_t_16;
3579 
3580  /* "subsurfaceTransportFunctions.pyx":114
3581  * for I in range(nd):
3582  * for J in range(nd):
3583  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J] # <<<<<<<<<<<<<<
3584  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
3585  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
3586  */
3587  if (unlikely(__pyx_v_material_functions == Py_None)) {
3588  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3589  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3590  }
3591  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3592  __Pyx_GOTREF(__pyx_t_17);
3593  __pyx_t_18 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_17); if (unlikely(__pyx_t_18 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
3594  __Pyx_GOTREF(__pyx_t_18);
3595  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
3596  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3597  __Pyx_GOTREF(__pyx_t_17);
3598  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3599  __Pyx_GOTREF(__pyx_t_19);
3600  __pyx_t_20 = PyTuple_New(2); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3601  __Pyx_GOTREF(__pyx_t_20);
3602  __Pyx_GIVEREF(__pyx_t_17);
3603  PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_17);
3604  __Pyx_GIVEREF(__pyx_t_19);
3605  PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_t_19);
3606  __pyx_t_17 = 0;
3607  __pyx_t_19 = 0;
3608  __pyx_t_19 = PyObject_GetItem(__pyx_t_18, __pyx_t_20); if (unlikely(__pyx_t_19 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
3609  __Pyx_GOTREF(__pyx_t_19);
3610  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
3611  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
3612  __pyx_t_20 = PyNumber_Multiply(__pyx_float_2_0, __pyx_t_19); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3613  __Pyx_GOTREF(__pyx_t_20);
3614  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
3615  if (unlikely(__pyx_v_material_functions == Py_None)) {
3616  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3617  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3618  }
3619  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3620  __Pyx_GOTREF(__pyx_t_19);
3621  __pyx_t_18 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_19); if (unlikely(__pyx_t_18 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
3622  __Pyx_GOTREF(__pyx_t_18);
3623  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
3624  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3625  __Pyx_GOTREF(__pyx_t_19);
3626  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3627  __Pyx_GOTREF(__pyx_t_17);
3628  __pyx_t_21 = PyTuple_New(2); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3629  __Pyx_GOTREF(__pyx_t_21);
3630  __Pyx_GIVEREF(__pyx_t_19);
3631  PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_19);
3632  __Pyx_GIVEREF(__pyx_t_17);
3633  PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_17);
3634  __pyx_t_19 = 0;
3635  __pyx_t_17 = 0;
3636  __pyx_t_17 = PyObject_GetItem(__pyx_t_18, __pyx_t_21); if (unlikely(__pyx_t_17 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
3637  __Pyx_GOTREF(__pyx_t_17);
3638  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
3639  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
3640  __pyx_t_21 = PyNumber_Multiply(__pyx_t_20, __pyx_t_17); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3641  __Pyx_GOTREF(__pyx_t_21);
3642  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
3643  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
3644  __pyx_t_22 = __pyx_PyFloat_AsDouble(__pyx_t_21); if (unlikely((__pyx_t_22 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3645  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
3646  __pyx_v_numer = __pyx_t_22;
3647 
3648  /* "subsurfaceTransportFunctions.pyx":115
3649  * for J in range(nd):
3650  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
3651  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20 # <<<<<<<<<<<<<<
3652  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
3653  *
3654  */
3655  if (unlikely(__pyx_v_material_functions == Py_None)) {
3656  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3657  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3658  }
3659  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3660  __Pyx_GOTREF(__pyx_t_21);
3661  __pyx_t_17 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_21); if (unlikely(__pyx_t_17 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
3662  __Pyx_GOTREF(__pyx_t_17);
3663  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
3664  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3665  __Pyx_GOTREF(__pyx_t_21);
3666  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3667  __Pyx_GOTREF(__pyx_t_20);
3668  __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3669  __Pyx_GOTREF(__pyx_t_18);
3670  __Pyx_GIVEREF(__pyx_t_21);
3671  PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_21);
3672  __Pyx_GIVEREF(__pyx_t_20);
3673  PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_20);
3674  __pyx_t_21 = 0;
3675  __pyx_t_20 = 0;
3676  __pyx_t_20 = PyObject_GetItem(__pyx_t_17, __pyx_t_18); if (unlikely(__pyx_t_20 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
3677  __Pyx_GOTREF(__pyx_t_20);
3678  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
3679  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
3680  if (unlikely(__pyx_v_material_functions == Py_None)) {
3681  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3682  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3683  }
3684  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3685  __Pyx_GOTREF(__pyx_t_18);
3686  __pyx_t_17 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_18); if (unlikely(__pyx_t_17 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
3687  __Pyx_GOTREF(__pyx_t_17);
3688  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
3689  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3690  __Pyx_GOTREF(__pyx_t_18);
3691  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3692  __Pyx_GOTREF(__pyx_t_21);
3693  __pyx_t_19 = PyTuple_New(2); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3694  __Pyx_GOTREF(__pyx_t_19);
3695  __Pyx_GIVEREF(__pyx_t_18);
3696  PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_18);
3697  __Pyx_GIVEREF(__pyx_t_21);
3698  PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_21);
3699  __pyx_t_18 = 0;
3700  __pyx_t_21 = 0;
3701  __pyx_t_21 = PyObject_GetItem(__pyx_t_17, __pyx_t_19); if (unlikely(__pyx_t_21 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
3702  __Pyx_GOTREF(__pyx_t_21);
3703  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
3704  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
3705  __pyx_t_19 = PyNumber_Add(__pyx_t_20, __pyx_t_21); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3706  __Pyx_GOTREF(__pyx_t_19);
3707  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
3708  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
3709  __pyx_t_21 = __Pyx_PyFloat_AddObjC(__pyx_t_19, __pyx_float_1_0eneg_20, 1.0e-20, 0); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3710  __Pyx_GOTREF(__pyx_t_21);
3711  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
3712  __pyx_t_22 = __pyx_PyFloat_AsDouble(__pyx_t_21); if (unlikely((__pyx_t_22 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3713  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
3714  __pyx_v_denom = __pyx_t_22;
3715 
3716  /* "subsurfaceTransportFunctions.pyx":116
3717  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
3718  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
3719  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom # <<<<<<<<<<<<<<
3720  *
3721  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
3722  */
3723  if (unlikely(__pyx_v_denom == 0)) {
3724  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
3725  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3726  }
3727  __pyx_t_23 = __pyx_v_eN;
3728  __pyx_t_24 = __pyx_v_ebN_local;
3729  __pyx_t_25 = __pyx_v_k;
3730  __pyx_t_26 = ((__pyx_v_I * __pyx_v_nd) + __pyx_v_J);
3731  __pyx_t_27 = -1;
3732  if (__pyx_t_23 < 0) {
3733  __pyx_t_23 += __pyx_pybuffernd_ebq_vals.diminfo[0].shape;
3734  if (unlikely(__pyx_t_23 < 0)) __pyx_t_27 = 0;
3735  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_ebq_vals.diminfo[0].shape)) __pyx_t_27 = 0;
3736  if (__pyx_t_24 < 0) {
3737  __pyx_t_24 += __pyx_pybuffernd_ebq_vals.diminfo[1].shape;
3738  if (unlikely(__pyx_t_24 < 0)) __pyx_t_27 = 1;
3739  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_ebq_vals.diminfo[1].shape)) __pyx_t_27 = 1;
3740  if (__pyx_t_25 < 0) {
3741  __pyx_t_25 += __pyx_pybuffernd_ebq_vals.diminfo[2].shape;
3742  if (unlikely(__pyx_t_25 < 0)) __pyx_t_27 = 2;
3743  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_ebq_vals.diminfo[2].shape)) __pyx_t_27 = 2;
3744  if (__pyx_t_26 < 0) {
3745  __pyx_t_26 += __pyx_pybuffernd_ebq_vals.diminfo[3].shape;
3746  if (unlikely(__pyx_t_26 < 0)) __pyx_t_27 = 3;
3747  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_ebq_vals.diminfo[3].shape)) __pyx_t_27 = 3;
3748  if (unlikely(__pyx_t_27 != -1)) {
3749  __Pyx_RaiseBufferIndexError(__pyx_t_27);
3750  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3751  }
3752  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_ebq_vals.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_ebq_vals.diminfo[1].strides, __pyx_t_25, __pyx_pybuffernd_ebq_vals.diminfo[2].strides, __pyx_t_26, __pyx_pybuffernd_ebq_vals.diminfo[3].strides) = (__pyx_v_numer / __pyx_v_denom);
3753  }
3754  }
3755  }
3756  }
3757  }
3758 
3759  /* "subsurfaceTransportFunctions.pyx":91
3760  * material_functions[material_right])
3761  *
3762  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
3763  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
3764  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
3765  */
3766 
3767  /* function exit code */
3768  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3769  goto __pyx_L0;
3770  __pyx_L1_error:;
3771  __Pyx_XDECREF(__pyx_t_17);
3772  __Pyx_XDECREF(__pyx_t_18);
3773  __Pyx_XDECREF(__pyx_t_19);
3774  __Pyx_XDECREF(__pyx_t_20);
3775  __Pyx_XDECREF(__pyx_t_21);
3776  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3777  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3778  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
3779  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
3780  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
3781  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3782  __Pyx_AddTraceback("subsurfaceTransportFunctions.setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
3783  __pyx_r = NULL;
3784  goto __pyx_L2;
3785  __pyx_L0:;
3786  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
3787  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
3788  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
3789  __pyx_L2:;
3790  __Pyx_XGIVEREF(__pyx_r);
3791  __Pyx_RefNannyFinishContext();
3792  return __pyx_r;
3793 }
3794 
3795 /* "subsurfaceTransportFunctions.pyx":118
3796  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
3797  *
3798  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
3799  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
3800  * numpy.ndarray[DTYPE_t,ndim=2] ebq_global_vals,
3801  */
3802 
3803 /* Python wrapper */
3804 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3805 static char __pyx_doc_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage[] = "\n loop over quadrature array and evaluate function f = 0.5(f^L_j+f^R_k) assuming element on left \n is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
3806 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage = {"setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage};
3807 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3808  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray = 0;
3809  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
3810  PyArrayObject *__pyx_v_ebq_global_vals = 0;
3811  PyObject *__pyx_v_material_functions = 0;
3812  int __pyx_lineno = 0;
3813  const char *__pyx_filename = NULL;
3814  int __pyx_clineno = 0;
3815  PyObject *__pyx_r = 0;
3816  __Pyx_RefNannyDeclarations
3817  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage (wrapper)", 0);
3818  {
3819  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_ebq_global_vals,&__pyx_n_s_material_functions,0};
3820  PyObject* values[4] = {0,0,0,0};
3821  if (unlikely(__pyx_kwds)) {
3822  Py_ssize_t kw_args;
3823  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3824  switch (pos_args) {
3825  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3826  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3827  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3828  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3829  case 0: break;
3830  default: goto __pyx_L5_argtuple_error;
3831  }
3832  kw_args = PyDict_Size(__pyx_kwds);
3833  switch (pos_args) {
3834  case 0:
3835  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
3836  else goto __pyx_L5_argtuple_error;
3837  case 1:
3838  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
3839  else {
3840  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3841  }
3842  case 2:
3843  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ebq_global_vals)) != 0)) kw_args--;
3844  else {
3845  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3846  }
3847  case 3:
3848  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
3849  else {
3850  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3851  }
3852  }
3853  if (unlikely(kw_args > 0)) {
3854  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3855  }
3856  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
3857  goto __pyx_L5_argtuple_error;
3858  } else {
3859  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3860  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3861  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3862  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3863  }
3864  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[0]);
3865  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[1]);
3866  __pyx_v_ebq_global_vals = ((PyArrayObject *)values[2]);
3867  __pyx_v_material_functions = ((PyObject*)values[3]);
3868  }
3869  goto __pyx_L4_argument_unpacking_done;
3870  __pyx_L5_argtuple_error:;
3871  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3872  __pyx_L3_error:;
3873  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
3874  __Pyx_RefNannyFinishContext();
3875  return NULL;
3876  __pyx_L4_argument_unpacking_done:;
3877  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3878  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3879  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_global_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_global_vals", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3880  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3881  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(__pyx_self, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_ebq_global_vals, __pyx_v_material_functions);
3882 
3883  /* function exit code */
3884  goto __pyx_L0;
3885  __pyx_L1_error:;
3886  __pyx_r = NULL;
3887  __pyx_L0:;
3888  __Pyx_RefNannyFinishContext();
3889  return __pyx_r;
3890 }
3891 
3892 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions) {
3893  int __pyx_v_ebN;
3894  int __pyx_v_material_left;
3895  int __pyx_v_material_right;
3896  npy_intp __pyx_v_k;
3897  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_global_vals;
3898  __Pyx_Buffer __pyx_pybuffer_ebq_global_vals;
3899  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
3900  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
3901  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
3902  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
3903  PyObject *__pyx_r = NULL;
3904  __Pyx_RefNannyDeclarations
3905  npy_intp __pyx_t_1;
3906  int __pyx_t_2;
3907  Py_ssize_t __pyx_t_3;
3908  Py_ssize_t __pyx_t_4;
3909  int __pyx_t_5;
3910  Py_ssize_t __pyx_t_6;
3911  Py_ssize_t __pyx_t_7;
3912  npy_intp __pyx_t_8;
3913  npy_intp __pyx_t_9;
3914  PyObject *__pyx_t_10 = NULL;
3915  PyObject *__pyx_t_11 = NULL;
3916  PyObject *__pyx_t_12 = NULL;
3917  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_13;
3918  Py_ssize_t __pyx_t_14;
3919  Py_ssize_t __pyx_t_15;
3920  int __pyx_lineno = 0;
3921  const char *__pyx_filename = NULL;
3922  int __pyx_clineno = 0;
3923  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 0);
3924  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
3925  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
3926  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
3927  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
3928  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
3929  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
3930  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
3931  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
3932  __pyx_pybuffer_ebq_global_vals.pybuffer.buf = NULL;
3933  __pyx_pybuffer_ebq_global_vals.refcount = 0;
3934  __pyx_pybuffernd_ebq_global_vals.data = NULL;
3935  __pyx_pybuffernd_ebq_global_vals.rcbuffer = &__pyx_pybuffer_ebq_global_vals;
3936  {
3937  __Pyx_BufFmt_StackElem __pyx_stack[1];
3938  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3939  }
3940  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
3941  {
3942  __Pyx_BufFmt_StackElem __pyx_stack[1];
3943  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3944  }
3945  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
3946  {
3947  __Pyx_BufFmt_StackElem __pyx_stack[1];
3948  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_global_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3949  }
3950  __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[1];
3951 
3952  /* "subsurfaceTransportFunctions.pyx":131
3953  * cdef int ebN,material_left,material_right
3954  *
3955  * for ebN in range(ebq_global_vals.shape[0]): # <<<<<<<<<<<<<<
3956  * material_left = elementBoundaryTypes[ebN,0]
3957  * material_right= elementBoundaryTypes[ebN,1]
3958  */
3959  __pyx_t_1 = (__pyx_v_ebq_global_vals->dimensions[0]);
3960  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
3961  __pyx_v_ebN = __pyx_t_2;
3962 
3963  /* "subsurfaceTransportFunctions.pyx":132
3964  *
3965  * for ebN in range(ebq_global_vals.shape[0]):
3966  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
3967  * material_right= elementBoundaryTypes[ebN,1]
3968  * for k in range(ebq_global_vals.shape[1]):
3969  */
3970  __pyx_t_3 = __pyx_v_ebN;
3971  __pyx_t_4 = 0;
3972  __pyx_t_5 = -1;
3973  if (__pyx_t_3 < 0) {
3974  __pyx_t_3 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
3975  if (unlikely(__pyx_t_3 < 0)) __pyx_t_5 = 0;
3976  } else if (unlikely(__pyx_t_3 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_5 = 0;
3977  if (__pyx_t_4 < 0) {
3978  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
3979  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 1;
3980  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_5 = 1;
3981  if (unlikely(__pyx_t_5 != -1)) {
3982  __Pyx_RaiseBufferIndexError(__pyx_t_5);
3983  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3984  }
3985  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
3986 
3987  /* "subsurfaceTransportFunctions.pyx":133
3988  * for ebN in range(ebq_global_vals.shape[0]):
3989  * material_left = elementBoundaryTypes[ebN,0]
3990  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
3991  * for k in range(ebq_global_vals.shape[1]):
3992  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+
3993  */
3994  __pyx_t_6 = __pyx_v_ebN;
3995  __pyx_t_7 = 1;
3996  __pyx_t_5 = -1;
3997  if (__pyx_t_6 < 0) {
3998  __pyx_t_6 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
3999  if (unlikely(__pyx_t_6 < 0)) __pyx_t_5 = 0;
4000  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_5 = 0;
4001  if (__pyx_t_7 < 0) {
4002  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4003  if (unlikely(__pyx_t_7 < 0)) __pyx_t_5 = 1;
4004  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_5 = 1;
4005  if (unlikely(__pyx_t_5 != -1)) {
4006  __Pyx_RaiseBufferIndexError(__pyx_t_5);
4007  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4008  }
4009  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4010 
4011  /* "subsurfaceTransportFunctions.pyx":134
4012  * material_left = elementBoundaryTypes[ebN,0]
4013  * material_right= elementBoundaryTypes[ebN,1]
4014  * for k in range(ebq_global_vals.shape[1]): # <<<<<<<<<<<<<<
4015  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+
4016  * material_functions[material_right])
4017  */
4018  __pyx_t_8 = (__pyx_v_ebq_global_vals->dimensions[1]);
4019  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
4020  __pyx_v_k = __pyx_t_9;
4021 
4022  /* "subsurfaceTransportFunctions.pyx":135
4023  * material_right= elementBoundaryTypes[ebN,1]
4024  * for k in range(ebq_global_vals.shape[1]):
4025  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+ # <<<<<<<<<<<<<<
4026  * material_functions[material_right])
4027  *
4028  */
4029  if (unlikely(__pyx_v_material_functions == Py_None)) {
4030  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4031  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4032  }
4033  __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4034  __Pyx_GOTREF(__pyx_t_10);
4035  __pyx_t_11 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_10); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
4036  __Pyx_GOTREF(__pyx_t_11);
4037  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4038 
4039  /* "subsurfaceTransportFunctions.pyx":136
4040  * for k in range(ebq_global_vals.shape[1]):
4041  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+
4042  * material_functions[material_right]) # <<<<<<<<<<<<<<
4043  *
4044  *
4045  */
4046  if (unlikely(__pyx_v_material_functions == Py_None)) {
4047  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4048  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4049  }
4050  __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4051  __Pyx_GOTREF(__pyx_t_10);
4052  __pyx_t_12 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_10); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
4053  __Pyx_GOTREF(__pyx_t_12);
4054  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4055 
4056  /* "subsurfaceTransportFunctions.pyx":135
4057  * material_right= elementBoundaryTypes[ebN,1]
4058  * for k in range(ebq_global_vals.shape[1]):
4059  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+ # <<<<<<<<<<<<<<
4060  * material_functions[material_right])
4061  *
4062  */
4063  __pyx_t_10 = PyNumber_Add(__pyx_t_11, __pyx_t_12); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4064  __Pyx_GOTREF(__pyx_t_10);
4065  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
4066  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
4067  __pyx_t_12 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_10); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4068  __Pyx_GOTREF(__pyx_t_12);
4069  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4070  __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_13 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4071  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
4072  __pyx_t_14 = __pyx_v_ebN;
4073  __pyx_t_15 = __pyx_v_k;
4074  __pyx_t_5 = -1;
4075  if (__pyx_t_14 < 0) {
4076  __pyx_t_14 += __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape;
4077  if (unlikely(__pyx_t_14 < 0)) __pyx_t_5 = 0;
4078  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape)) __pyx_t_5 = 0;
4079  if (__pyx_t_15 < 0) {
4080  __pyx_t_15 += __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape;
4081  if (unlikely(__pyx_t_15 < 0)) __pyx_t_5 = 1;
4082  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape)) __pyx_t_5 = 1;
4083  if (unlikely(__pyx_t_5 != -1)) {
4084  __Pyx_RaiseBufferIndexError(__pyx_t_5);
4085  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4086  }
4087  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides) = __pyx_t_13;
4088  }
4089  }
4090 
4091  /* "subsurfaceTransportFunctions.pyx":118
4092  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
4093  *
4094  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
4095  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
4096  * numpy.ndarray[DTYPE_t,ndim=2] ebq_global_vals,
4097  */
4098 
4099  /* function exit code */
4100  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4101  goto __pyx_L0;
4102  __pyx_L1_error:;
4103  __Pyx_XDECREF(__pyx_t_10);
4104  __Pyx_XDECREF(__pyx_t_11);
4105  __Pyx_XDECREF(__pyx_t_12);
4106  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
4107  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
4108  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
4109  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
4110  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
4111  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
4112  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
4113  __pyx_r = NULL;
4114  goto __pyx_L2;
4115  __pyx_L0:;
4116  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
4117  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
4118  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
4119  __pyx_L2:;
4120  __Pyx_XGIVEREF(__pyx_r);
4121  __Pyx_RefNannyFinishContext();
4122  return __pyx_r;
4123 }
4124 
4125 /* "subsurfaceTransportFunctions.pyx":139
4126  *
4127  *
4128  * def setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
4129  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
4130  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
4131  */
4132 
4133 /* Python wrapper */
4134 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4135 static char __pyx_doc_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage[] = "\n loop over quadrature array and evaluate function \ten f_{mn} = f^L_{j,mn}f^R_{k,mn}/(f^L_{j,mn}+f^R_{k,mn})\n assuming element on left is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
4136 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage = {"setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage};
4137 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4138  int __pyx_v_nd;
4139  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray = 0;
4140  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
4141  PyArrayObject *__pyx_v_ebq_global_vals = 0;
4142  PyObject *__pyx_v_material_functions = 0;
4143  int __pyx_lineno = 0;
4144  const char *__pyx_filename = NULL;
4145  int __pyx_clineno = 0;
4146  PyObject *__pyx_r = 0;
4147  __Pyx_RefNannyDeclarations
4148  __Pyx_RefNannySetupContext("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage (wrapper)", 0);
4149  {
4150  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nd,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_ebq_global_vals,&__pyx_n_s_material_functions,0};
4151  PyObject* values[5] = {0,0,0,0,0};
4152  if (unlikely(__pyx_kwds)) {
4153  Py_ssize_t kw_args;
4154  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4155  switch (pos_args) {
4156  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4157  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4158  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4159  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4160  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4161  case 0: break;
4162  default: goto __pyx_L5_argtuple_error;
4163  }
4164  kw_args = PyDict_Size(__pyx_kwds);
4165  switch (pos_args) {
4166  case 0:
4167  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
4168  else goto __pyx_L5_argtuple_error;
4169  case 1:
4170  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
4171  else {
4172  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4173  }
4174  case 2:
4175  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
4176  else {
4177  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4178  }
4179  case 3:
4180  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ebq_global_vals)) != 0)) kw_args--;
4181  else {
4182  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4183  }
4184  case 4:
4185  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
4186  else {
4187  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4188  }
4189  }
4190  if (unlikely(kw_args > 0)) {
4191  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4192  }
4193  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
4194  goto __pyx_L5_argtuple_error;
4195  } else {
4196  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4197  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4198  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4199  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4200  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4201  }
4202  __pyx_v_nd = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4203  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[1]);
4204  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[2]);
4205  __pyx_v_ebq_global_vals = ((PyArrayObject *)values[3]);
4206  __pyx_v_material_functions = ((PyObject*)values[4]);
4207  }
4208  goto __pyx_L4_argument_unpacking_done;
4209  __pyx_L5_argtuple_error:;
4210  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4211  __pyx_L3_error:;
4212  __Pyx_AddTraceback("subsurfaceTransportFunctions.setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
4213  __Pyx_RefNannyFinishContext();
4214  return NULL;
4215  __pyx_L4_argument_unpacking_done:;
4216  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4217  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4218  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_global_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_global_vals", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4219  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4220  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(__pyx_self, __pyx_v_nd, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_ebq_global_vals, __pyx_v_material_functions);
4221 
4222  /* function exit code */
4223  goto __pyx_L0;
4224  __pyx_L1_error:;
4225  __pyx_r = NULL;
4226  __pyx_L0:;
4227  __Pyx_RefNannyFinishContext();
4228  return __pyx_r;
4229 }
4230 
4231 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions) {
4232  int __pyx_v_ebN;
4233  int __pyx_v_k;
4234  int __pyx_v_material_left;
4235  int __pyx_v_material_right;
4236  int __pyx_v_I;
4237  int __pyx_v_J;
4238  double __pyx_v_numer;
4239  double __pyx_v_denom;
4240  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_global_vals;
4241  __Pyx_Buffer __pyx_pybuffer_ebq_global_vals;
4242  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
4243  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
4244  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
4245  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
4246  PyObject *__pyx_r = NULL;
4247  __Pyx_RefNannyDeclarations
4248  npy_intp __pyx_t_1;
4249  int __pyx_t_2;
4250  Py_ssize_t __pyx_t_3;
4251  Py_ssize_t __pyx_t_4;
4252  int __pyx_t_5;
4253  Py_ssize_t __pyx_t_6;
4254  Py_ssize_t __pyx_t_7;
4255  npy_intp __pyx_t_8;
4256  int __pyx_t_9;
4257  int __pyx_t_10;
4258  int __pyx_t_11;
4259  int __pyx_t_12;
4260  PyObject *__pyx_t_13 = NULL;
4261  PyObject *__pyx_t_14 = NULL;
4262  PyObject *__pyx_t_15 = NULL;
4263  PyObject *__pyx_t_16 = NULL;
4264  PyObject *__pyx_t_17 = NULL;
4265  double __pyx_t_18;
4266  Py_ssize_t __pyx_t_19;
4267  Py_ssize_t __pyx_t_20;
4268  Py_ssize_t __pyx_t_21;
4269  int __pyx_t_22;
4270  int __pyx_lineno = 0;
4271  const char *__pyx_filename = NULL;
4272  int __pyx_clineno = 0;
4273  __Pyx_RefNannySetupContext("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 0);
4274  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
4275  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
4276  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
4277  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
4278  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
4279  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
4280  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
4281  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
4282  __pyx_pybuffer_ebq_global_vals.pybuffer.buf = NULL;
4283  __pyx_pybuffer_ebq_global_vals.refcount = 0;
4284  __pyx_pybuffernd_ebq_global_vals.data = NULL;
4285  __pyx_pybuffernd_ebq_global_vals.rcbuffer = &__pyx_pybuffer_ebq_global_vals;
4286  {
4287  __Pyx_BufFmt_StackElem __pyx_stack[1];
4288  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4289  }
4290  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
4291  {
4292  __Pyx_BufFmt_StackElem __pyx_stack[1];
4293  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4294  }
4295  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
4296  {
4297  __Pyx_BufFmt_StackElem __pyx_stack[1];
4298  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_global_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4299  }
4300  __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[2];
4301 
4302  /* "subsurfaceTransportFunctions.pyx":154
4303  * cdef double numer,denom
4304  *
4305  * for ebN in range(ebq_global_vals.shape[0]): # <<<<<<<<<<<<<<
4306  * material_left = elementBoundaryTypes[ebN,0]
4307  * material_right= elementBoundaryTypes[ebN,1]
4308  */
4309  __pyx_t_1 = (__pyx_v_ebq_global_vals->dimensions[0]);
4310  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
4311  __pyx_v_ebN = __pyx_t_2;
4312 
4313  /* "subsurfaceTransportFunctions.pyx":155
4314  *
4315  * for ebN in range(ebq_global_vals.shape[0]):
4316  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
4317  * material_right= elementBoundaryTypes[ebN,1]
4318  * for k in range(ebq_global_vals.shape[1]):
4319  */
4320  __pyx_t_3 = __pyx_v_ebN;
4321  __pyx_t_4 = 0;
4322  __pyx_t_5 = -1;
4323  if (__pyx_t_3 < 0) {
4324  __pyx_t_3 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
4325  if (unlikely(__pyx_t_3 < 0)) __pyx_t_5 = 0;
4326  } else if (unlikely(__pyx_t_3 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_5 = 0;
4327  if (__pyx_t_4 < 0) {
4328  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4329  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 1;
4330  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_5 = 1;
4331  if (unlikely(__pyx_t_5 != -1)) {
4332  __Pyx_RaiseBufferIndexError(__pyx_t_5);
4333  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4334  }
4335  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4336 
4337  /* "subsurfaceTransportFunctions.pyx":156
4338  * for ebN in range(ebq_global_vals.shape[0]):
4339  * material_left = elementBoundaryTypes[ebN,0]
4340  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
4341  * for k in range(ebq_global_vals.shape[1]):
4342  * for I in range(nd):
4343  */
4344  __pyx_t_6 = __pyx_v_ebN;
4345  __pyx_t_7 = 1;
4346  __pyx_t_5 = -1;
4347  if (__pyx_t_6 < 0) {
4348  __pyx_t_6 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
4349  if (unlikely(__pyx_t_6 < 0)) __pyx_t_5 = 0;
4350  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_5 = 0;
4351  if (__pyx_t_7 < 0) {
4352  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4353  if (unlikely(__pyx_t_7 < 0)) __pyx_t_5 = 1;
4354  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_5 = 1;
4355  if (unlikely(__pyx_t_5 != -1)) {
4356  __Pyx_RaiseBufferIndexError(__pyx_t_5);
4357  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4358  }
4359  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4360 
4361  /* "subsurfaceTransportFunctions.pyx":157
4362  * material_left = elementBoundaryTypes[ebN,0]
4363  * material_right= elementBoundaryTypes[ebN,1]
4364  * for k in range(ebq_global_vals.shape[1]): # <<<<<<<<<<<<<<
4365  * for I in range(nd):
4366  * for J in range(nd):
4367  */
4368  __pyx_t_8 = (__pyx_v_ebq_global_vals->dimensions[1]);
4369  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_8; __pyx_t_5+=1) {
4370  __pyx_v_k = __pyx_t_5;
4371 
4372  /* "subsurfaceTransportFunctions.pyx":158
4373  * material_right= elementBoundaryTypes[ebN,1]
4374  * for k in range(ebq_global_vals.shape[1]):
4375  * for I in range(nd): # <<<<<<<<<<<<<<
4376  * for J in range(nd):
4377  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
4378  */
4379  __pyx_t_9 = __pyx_v_nd;
4380  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
4381  __pyx_v_I = __pyx_t_10;
4382 
4383  /* "subsurfaceTransportFunctions.pyx":159
4384  * for k in range(ebq_global_vals.shape[1]):
4385  * for I in range(nd):
4386  * for J in range(nd): # <<<<<<<<<<<<<<
4387  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
4388  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
4389  */
4390  __pyx_t_11 = __pyx_v_nd;
4391  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
4392  __pyx_v_J = __pyx_t_12;
4393 
4394  /* "subsurfaceTransportFunctions.pyx":160
4395  * for I in range(nd):
4396  * for J in range(nd):
4397  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J] # <<<<<<<<<<<<<<
4398  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
4399  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom
4400  */
4401  if (unlikely(__pyx_v_material_functions == Py_None)) {
4402  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4403  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4404  }
4405  __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4406  __Pyx_GOTREF(__pyx_t_13);
4407  __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_13); if (unlikely(__pyx_t_14 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
4408  __Pyx_GOTREF(__pyx_t_14);
4409  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
4410  __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4411  __Pyx_GOTREF(__pyx_t_13);
4412  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4413  __Pyx_GOTREF(__pyx_t_15);
4414  __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4415  __Pyx_GOTREF(__pyx_t_16);
4416  __Pyx_GIVEREF(__pyx_t_13);
4417  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_13);
4418  __Pyx_GIVEREF(__pyx_t_15);
4419  PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_15);
4420  __pyx_t_13 = 0;
4421  __pyx_t_15 = 0;
4422  __pyx_t_15 = PyObject_GetItem(__pyx_t_14, __pyx_t_16); if (unlikely(__pyx_t_15 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
4423  __Pyx_GOTREF(__pyx_t_15);
4424  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
4425  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
4426  __pyx_t_16 = PyNumber_Multiply(__pyx_float_2_0, __pyx_t_15); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4427  __Pyx_GOTREF(__pyx_t_16);
4428  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
4429  if (unlikely(__pyx_v_material_functions == Py_None)) {
4430  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4431  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4432  }
4433  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4434  __Pyx_GOTREF(__pyx_t_15);
4435  __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_15); if (unlikely(__pyx_t_14 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
4436  __Pyx_GOTREF(__pyx_t_14);
4437  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
4438  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4439  __Pyx_GOTREF(__pyx_t_15);
4440  __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4441  __Pyx_GOTREF(__pyx_t_13);
4442  __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4443  __Pyx_GOTREF(__pyx_t_17);
4444  __Pyx_GIVEREF(__pyx_t_15);
4445  PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_15);
4446  __Pyx_GIVEREF(__pyx_t_13);
4447  PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_13);
4448  __pyx_t_15 = 0;
4449  __pyx_t_13 = 0;
4450  __pyx_t_13 = PyObject_GetItem(__pyx_t_14, __pyx_t_17); if (unlikely(__pyx_t_13 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
4451  __Pyx_GOTREF(__pyx_t_13);
4452  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
4453  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
4454  __pyx_t_17 = PyNumber_Multiply(__pyx_t_16, __pyx_t_13); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4455  __Pyx_GOTREF(__pyx_t_17);
4456  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
4457  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
4458  __pyx_t_18 = __pyx_PyFloat_AsDouble(__pyx_t_17); if (unlikely((__pyx_t_18 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4459  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
4460  __pyx_v_numer = __pyx_t_18;
4461 
4462  /* "subsurfaceTransportFunctions.pyx":161
4463  * for J in range(nd):
4464  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
4465  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20 # <<<<<<<<<<<<<<
4466  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom
4467  *
4468  */
4469  if (unlikely(__pyx_v_material_functions == Py_None)) {
4470  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4471  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4472  }
4473  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4474  __Pyx_GOTREF(__pyx_t_17);
4475  __pyx_t_13 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_17); if (unlikely(__pyx_t_13 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
4476  __Pyx_GOTREF(__pyx_t_13);
4477  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
4478  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4479  __Pyx_GOTREF(__pyx_t_17);
4480  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4481  __Pyx_GOTREF(__pyx_t_16);
4482  __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4483  __Pyx_GOTREF(__pyx_t_14);
4484  __Pyx_GIVEREF(__pyx_t_17);
4485  PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_17);
4486  __Pyx_GIVEREF(__pyx_t_16);
4487  PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_16);
4488  __pyx_t_17 = 0;
4489  __pyx_t_16 = 0;
4490  __pyx_t_16 = PyObject_GetItem(__pyx_t_13, __pyx_t_14); if (unlikely(__pyx_t_16 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
4491  __Pyx_GOTREF(__pyx_t_16);
4492  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
4493  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
4494  if (unlikely(__pyx_v_material_functions == Py_None)) {
4495  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4496  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4497  }
4498  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4499  __Pyx_GOTREF(__pyx_t_14);
4500  __pyx_t_13 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_14); if (unlikely(__pyx_t_13 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
4501  __Pyx_GOTREF(__pyx_t_13);
4502  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
4503  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4504  __Pyx_GOTREF(__pyx_t_14);
4505  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4506  __Pyx_GOTREF(__pyx_t_17);
4507  __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4508  __Pyx_GOTREF(__pyx_t_15);
4509  __Pyx_GIVEREF(__pyx_t_14);
4510  PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_14);
4511  __Pyx_GIVEREF(__pyx_t_17);
4512  PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_17);
4513  __pyx_t_14 = 0;
4514  __pyx_t_17 = 0;
4515  __pyx_t_17 = PyObject_GetItem(__pyx_t_13, __pyx_t_15); if (unlikely(__pyx_t_17 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
4516  __Pyx_GOTREF(__pyx_t_17);
4517  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
4518  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
4519  __pyx_t_15 = PyNumber_Add(__pyx_t_16, __pyx_t_17); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4520  __Pyx_GOTREF(__pyx_t_15);
4521  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
4522  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
4523  __pyx_t_17 = __Pyx_PyFloat_AddObjC(__pyx_t_15, __pyx_float_1_0eneg_20, 1.0e-20, 0); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4524  __Pyx_GOTREF(__pyx_t_17);
4525  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
4526  __pyx_t_18 = __pyx_PyFloat_AsDouble(__pyx_t_17); if (unlikely((__pyx_t_18 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4527  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
4528  __pyx_v_denom = __pyx_t_18;
4529 
4530  /* "subsurfaceTransportFunctions.pyx":162
4531  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
4532  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
4533  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom # <<<<<<<<<<<<<<
4534  *
4535  * ###
4536  */
4537  if (unlikely(__pyx_v_denom == 0)) {
4538  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
4539  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4540  }
4541  __pyx_t_19 = __pyx_v_ebN;
4542  __pyx_t_20 = __pyx_v_k;
4543  __pyx_t_21 = ((__pyx_v_I * __pyx_v_nd) + __pyx_v_J);
4544  __pyx_t_22 = -1;
4545  if (__pyx_t_19 < 0) {
4546  __pyx_t_19 += __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape;
4547  if (unlikely(__pyx_t_19 < 0)) __pyx_t_22 = 0;
4548  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape)) __pyx_t_22 = 0;
4549  if (__pyx_t_20 < 0) {
4550  __pyx_t_20 += __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape;
4551  if (unlikely(__pyx_t_20 < 0)) __pyx_t_22 = 1;
4552  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape)) __pyx_t_22 = 1;
4553  if (__pyx_t_21 < 0) {
4554  __pyx_t_21 += __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape;
4555  if (unlikely(__pyx_t_21 < 0)) __pyx_t_22 = 2;
4556  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape)) __pyx_t_22 = 2;
4557  if (unlikely(__pyx_t_22 != -1)) {
4558  __Pyx_RaiseBufferIndexError(__pyx_t_22);
4559  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4560  }
4561  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides, __pyx_t_21, __pyx_pybuffernd_ebq_global_vals.diminfo[2].strides) = (__pyx_v_numer / __pyx_v_denom);
4562  }
4563  }
4564  }
4565  }
4566 
4567  /* "subsurfaceTransportFunctions.pyx":139
4568  *
4569  *
4570  * def setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
4571  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
4572  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
4573  */
4574 
4575  /* function exit code */
4576  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4577  goto __pyx_L0;
4578  __pyx_L1_error:;
4579  __Pyx_XDECREF(__pyx_t_13);
4580  __Pyx_XDECREF(__pyx_t_14);
4581  __Pyx_XDECREF(__pyx_t_15);
4582  __Pyx_XDECREF(__pyx_t_16);
4583  __Pyx_XDECREF(__pyx_t_17);
4584  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
4585  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
4586  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
4587  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
4588  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
4589  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
4590  __Pyx_AddTraceback("subsurfaceTransportFunctions.setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
4591  __pyx_r = NULL;
4592  goto __pyx_L2;
4593  __pyx_L0:;
4594  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
4595  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
4596  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
4597  __pyx_L2:;
4598  __Pyx_XGIVEREF(__pyx_r);
4599  __Pyx_RefNannyFinishContext();
4600  return __pyx_r;
4601 }
4602 
4603 /* "subsurfaceTransportFunctions.pyx":165
4604  *
4605  * ###
4606  * def evaluateScalarMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
4607  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
4608  * numpy.ndarray[DTYPE_t,ndim=3] x,
4609  */
4610 
4611 /* Python wrapper */
4612 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4613 static char __pyx_doc_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements[] = "\n loop over quadrature array and evaluate function f_j(x,t) assuming element is material j\n likely little improvement right now without correct typing of material_functions\n ";
4614 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements = {"evaluateScalarMaterialFunctionOverElements", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements};
4615 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4616  double __pyx_v_t;
4617  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
4618  PyArrayObject *__pyx_v_x = 0;
4619  PyArrayObject *__pyx_v_q_vals = 0;
4620  PyObject *__pyx_v_material_functions = 0;
4621  int __pyx_lineno = 0;
4622  const char *__pyx_filename = NULL;
4623  int __pyx_clineno = 0;
4624  PyObject *__pyx_r = 0;
4625  __Pyx_RefNannyDeclarations
4626  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverElements (wrapper)", 0);
4627  {
4628  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_x,&__pyx_n_s_q_vals,&__pyx_n_s_material_functions,0};
4629  PyObject* values[5] = {0,0,0,0,0};
4630  if (unlikely(__pyx_kwds)) {
4631  Py_ssize_t kw_args;
4632  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4633  switch (pos_args) {
4634  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4635  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4636  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4637  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4638  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4639  case 0: break;
4640  default: goto __pyx_L5_argtuple_error;
4641  }
4642  kw_args = PyDict_Size(__pyx_kwds);
4643  switch (pos_args) {
4644  case 0:
4645  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
4646  else goto __pyx_L5_argtuple_error;
4647  case 1:
4648  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
4649  else {
4650  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4651  }
4652  case 2:
4653  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
4654  else {
4655  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4656  }
4657  case 3:
4658  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_vals)) != 0)) kw_args--;
4659  else {
4660  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4661  }
4662  case 4:
4663  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
4664  else {
4665  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4666  }
4667  }
4668  if (unlikely(kw_args > 0)) {
4669  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateScalarMaterialFunctionOverElements") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4670  }
4671  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
4672  goto __pyx_L5_argtuple_error;
4673  } else {
4674  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4675  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4676  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4677  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4678  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4679  }
4680  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4681  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[1]);
4682  __pyx_v_x = ((PyArrayObject *)values[2]);
4683  __pyx_v_q_vals = ((PyArrayObject *)values[3]);
4684  __pyx_v_material_functions = ((PyObject*)values[4]);
4685  }
4686  goto __pyx_L4_argument_unpacking_done;
4687  __pyx_L5_argtuple_error:;
4688  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4689  __pyx_L3_error:;
4690  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
4691  __Pyx_RefNannyFinishContext();
4692  return NULL;
4693  __pyx_L4_argument_unpacking_done:;
4694  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4695  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4696  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_vals), __pyx_ptype_5numpy_ndarray, 1, "q_vals", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4697  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4698  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements(__pyx_self, __pyx_v_t, __pyx_v_elementMaterialTypes, __pyx_v_x, __pyx_v_q_vals, __pyx_v_material_functions);
4699 
4700  /* function exit code */
4701  goto __pyx_L0;
4702  __pyx_L1_error:;
4703  __pyx_r = NULL;
4704  __pyx_L0:;
4705  __Pyx_RefNannyFinishContext();
4706  return __pyx_r;
4707 }
4708 
4709 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions) {
4710  int __pyx_v_eN;
4711  int __pyx_v_k;
4712  int __pyx_v_material;
4713  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
4714  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
4715  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_vals;
4716  __Pyx_Buffer __pyx_pybuffer_q_vals;
4717  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
4718  __Pyx_Buffer __pyx_pybuffer_x;
4719  PyObject *__pyx_r = NULL;
4720  __Pyx_RefNannyDeclarations
4721  npy_intp __pyx_t_1;
4722  int __pyx_t_2;
4723  Py_ssize_t __pyx_t_3;
4724  int __pyx_t_4;
4725  npy_intp __pyx_t_5;
4726  PyObject *__pyx_t_6 = NULL;
4727  PyObject *__pyx_t_7 = NULL;
4728  PyObject *__pyx_t_8 = NULL;
4729  PyObject *__pyx_t_9 = NULL;
4730  PyObject *__pyx_t_10 = NULL;
4731  Py_ssize_t __pyx_t_11;
4732  PyObject *__pyx_t_12 = NULL;
4733  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_13;
4734  Py_ssize_t __pyx_t_14;
4735  Py_ssize_t __pyx_t_15;
4736  int __pyx_t_16;
4737  int __pyx_lineno = 0;
4738  const char *__pyx_filename = NULL;
4739  int __pyx_clineno = 0;
4740  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverElements", 0);
4741  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
4742  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
4743  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
4744  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
4745  __pyx_pybuffer_x.pybuffer.buf = NULL;
4746  __pyx_pybuffer_x.refcount = 0;
4747  __pyx_pybuffernd_x.data = NULL;
4748  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
4749  __pyx_pybuffer_q_vals.pybuffer.buf = NULL;
4750  __pyx_pybuffer_q_vals.refcount = 0;
4751  __pyx_pybuffernd_q_vals.data = NULL;
4752  __pyx_pybuffernd_q_vals.rcbuffer = &__pyx_pybuffer_q_vals;
4753  {
4754  __Pyx_BufFmt_StackElem __pyx_stack[1];
4755  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4756  }
4757  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
4758  {
4759  __Pyx_BufFmt_StackElem __pyx_stack[1];
4760  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4761  }
4762  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
4763  {
4764  __Pyx_BufFmt_StackElem __pyx_stack[1];
4765  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4766  }
4767  __pyx_pybuffernd_q_vals.diminfo[0].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_vals.diminfo[0].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_vals.diminfo[1].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_vals.diminfo[1].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[1];
4768 
4769  /* "subsurfaceTransportFunctions.pyx":175
4770  * """
4771  * cdef int eN,k,material
4772  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
4773  * material = elementMaterialTypes[eN]
4774  * for k in range(x.shape[1]):
4775  */
4776  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
4777  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
4778  __pyx_v_eN = __pyx_t_2;
4779 
4780  /* "subsurfaceTransportFunctions.pyx":176
4781  * cdef int eN,k,material
4782  * for eN in range(x.shape[0]):
4783  * material = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
4784  * for k in range(x.shape[1]):
4785  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
4786  */
4787  __pyx_t_3 = __pyx_v_eN;
4788  __pyx_t_4 = -1;
4789  if (__pyx_t_3 < 0) {
4790  __pyx_t_3 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
4791  if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 0;
4792  } else if (unlikely(__pyx_t_3 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_4 = 0;
4793  if (unlikely(__pyx_t_4 != -1)) {
4794  __Pyx_RaiseBufferIndexError(__pyx_t_4);
4795  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4796  }
4797  __pyx_v_material = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
4798 
4799  /* "subsurfaceTransportFunctions.pyx":177
4800  * for eN in range(x.shape[0]):
4801  * material = elementMaterialTypes[eN]
4802  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
4803  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
4804  *
4805  */
4806  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
4807  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_5; __pyx_t_4+=1) {
4808  __pyx_v_k = __pyx_t_4;
4809 
4810  /* "subsurfaceTransportFunctions.pyx":178
4811  * material = elementMaterialTypes[eN]
4812  * for k in range(x.shape[1]):
4813  * q_vals[eN,k] = material_functions[material](x[eN,k],t) # <<<<<<<<<<<<<<
4814  *
4815  * def evaluateVectorMaterialFunctionOverElements(double t,
4816  */
4817  if (unlikely(__pyx_v_material_functions == Py_None)) {
4818  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4819  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4820  }
4821  __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_material); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4822  __Pyx_GOTREF(__pyx_t_7);
4823  __pyx_t_8 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_7); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
4824  __Pyx_GOTREF(__pyx_t_8);
4825  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4826  __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4827  __Pyx_GOTREF(__pyx_t_7);
4828  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4829  __Pyx_GOTREF(__pyx_t_9);
4830  __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4831  __Pyx_GOTREF(__pyx_t_10);
4832  __Pyx_GIVEREF(__pyx_t_7);
4833  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_7);
4834  __Pyx_GIVEREF(__pyx_t_9);
4835  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9);
4836  __pyx_t_7 = 0;
4837  __pyx_t_9 = 0;
4838  __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_10); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
4839  __Pyx_GOTREF(__pyx_t_9);
4840  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4841  __pyx_t_10 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4842  __Pyx_GOTREF(__pyx_t_10);
4843  __pyx_t_7 = NULL;
4844  __pyx_t_11 = 0;
4845  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_8))) {
4846  __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
4847  if (likely(__pyx_t_7)) {
4848  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
4849  __Pyx_INCREF(__pyx_t_7);
4850  __Pyx_INCREF(function);
4851  __Pyx_DECREF_SET(__pyx_t_8, function);
4852  __pyx_t_11 = 1;
4853  }
4854  }
4855  __pyx_t_12 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4856  __Pyx_GOTREF(__pyx_t_12);
4857  if (__pyx_t_7) {
4858  __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_7); __pyx_t_7 = NULL;
4859  }
4860  __Pyx_GIVEREF(__pyx_t_9);
4861  PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_t_9);
4862  __Pyx_GIVEREF(__pyx_t_10);
4863  PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_t_10);
4864  __pyx_t_9 = 0;
4865  __pyx_t_10 = 0;
4866  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_12, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4867  __Pyx_GOTREF(__pyx_t_6);
4868  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
4869  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4870  __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_13 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4871  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4872  __pyx_t_14 = __pyx_v_eN;
4873  __pyx_t_15 = __pyx_v_k;
4874  __pyx_t_16 = -1;
4875  if (__pyx_t_14 < 0) {
4876  __pyx_t_14 += __pyx_pybuffernd_q_vals.diminfo[0].shape;
4877  if (unlikely(__pyx_t_14 < 0)) __pyx_t_16 = 0;
4878  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_q_vals.diminfo[0].shape)) __pyx_t_16 = 0;
4879  if (__pyx_t_15 < 0) {
4880  __pyx_t_15 += __pyx_pybuffernd_q_vals.diminfo[1].shape;
4881  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 1;
4882  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_vals.diminfo[1].shape)) __pyx_t_16 = 1;
4883  if (unlikely(__pyx_t_16 != -1)) {
4884  __Pyx_RaiseBufferIndexError(__pyx_t_16);
4885  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4886  }
4887  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_q_vals.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_vals.diminfo[1].strides) = __pyx_t_13;
4888  }
4889  }
4890 
4891  /* "subsurfaceTransportFunctions.pyx":165
4892  *
4893  * ###
4894  * def evaluateScalarMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
4895  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
4896  * numpy.ndarray[DTYPE_t,ndim=3] x,
4897  */
4898 
4899  /* function exit code */
4900  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4901  goto __pyx_L0;
4902  __pyx_L1_error:;
4903  __Pyx_XDECREF(__pyx_t_6);
4904  __Pyx_XDECREF(__pyx_t_7);
4905  __Pyx_XDECREF(__pyx_t_8);
4906  __Pyx_XDECREF(__pyx_t_9);
4907  __Pyx_XDECREF(__pyx_t_10);
4908  __Pyx_XDECREF(__pyx_t_12);
4909  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
4910  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
4911  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
4912  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
4913  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
4914  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
4915  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
4916  __pyx_r = NULL;
4917  goto __pyx_L2;
4918  __pyx_L0:;
4919  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
4920  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
4921  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
4922  __pyx_L2:;
4923  __Pyx_XGIVEREF(__pyx_r);
4924  __Pyx_RefNannyFinishContext();
4925  return __pyx_r;
4926 }
4927 
4928 /* "subsurfaceTransportFunctions.pyx":180
4929  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
4930  *
4931  * def evaluateVectorMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
4932  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
4933  * numpy.ndarray[DTYPE_t,ndim=3] x,
4934  */
4935 
4936 /* Python wrapper */
4937 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4938 static char __pyx_doc_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements[] = "\n loop over quadrature array and evaluate function \013ec f_j(x,t) assuming element is material j\n ";
4939 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements = {"evaluateVectorMaterialFunctionOverElements", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements};
4940 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4941  double __pyx_v_t;
4942  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
4943  PyArrayObject *__pyx_v_x = 0;
4944  PyArrayObject *__pyx_v_q_vals = 0;
4945  PyObject *__pyx_v_material_functions = 0;
4946  int __pyx_lineno = 0;
4947  const char *__pyx_filename = NULL;
4948  int __pyx_clineno = 0;
4949  PyObject *__pyx_r = 0;
4950  __Pyx_RefNannyDeclarations
4951  __Pyx_RefNannySetupContext("evaluateVectorMaterialFunctionOverElements (wrapper)", 0);
4952  {
4953  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_x,&__pyx_n_s_q_vals,&__pyx_n_s_material_functions,0};
4954  PyObject* values[5] = {0,0,0,0,0};
4955  if (unlikely(__pyx_kwds)) {
4956  Py_ssize_t kw_args;
4957  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4958  switch (pos_args) {
4959  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4960  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4961  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4962  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4963  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4964  case 0: break;
4965  default: goto __pyx_L5_argtuple_error;
4966  }
4967  kw_args = PyDict_Size(__pyx_kwds);
4968  switch (pos_args) {
4969  case 0:
4970  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
4971  else goto __pyx_L5_argtuple_error;
4972  case 1:
4973  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
4974  else {
4975  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4976  }
4977  case 2:
4978  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
4979  else {
4980  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4981  }
4982  case 3:
4983  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_vals)) != 0)) kw_args--;
4984  else {
4985  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4986  }
4987  case 4:
4988  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
4989  else {
4990  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4991  }
4992  }
4993  if (unlikely(kw_args > 0)) {
4994  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateVectorMaterialFunctionOverElements") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4995  }
4996  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
4997  goto __pyx_L5_argtuple_error;
4998  } else {
4999  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5000  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5001  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5002  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5003  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5004  }
5005  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5006  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[1]);
5007  __pyx_v_x = ((PyArrayObject *)values[2]);
5008  __pyx_v_q_vals = ((PyArrayObject *)values[3]);
5009  __pyx_v_material_functions = ((PyObject*)values[4]);
5010  }
5011  goto __pyx_L4_argument_unpacking_done;
5012  __pyx_L5_argtuple_error:;
5013  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5014  __pyx_L3_error:;
5015  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateVectorMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
5016  __Pyx_RefNannyFinishContext();
5017  return NULL;
5018  __pyx_L4_argument_unpacking_done:;
5019  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5020  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5021  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_vals), __pyx_ptype_5numpy_ndarray, 1, "q_vals", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5022  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5023  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements(__pyx_self, __pyx_v_t, __pyx_v_elementMaterialTypes, __pyx_v_x, __pyx_v_q_vals, __pyx_v_material_functions);
5024 
5025  /* function exit code */
5026  goto __pyx_L0;
5027  __pyx_L1_error:;
5028  __pyx_r = NULL;
5029  __pyx_L0:;
5030  __Pyx_RefNannyFinishContext();
5031  return __pyx_r;
5032 }
5033 
5034 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions) {
5035  int __pyx_v_eN;
5036  int __pyx_v_k;
5037  int __pyx_v_material;
5038  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
5039  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
5040  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_vals;
5041  __Pyx_Buffer __pyx_pybuffer_q_vals;
5042  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
5043  __Pyx_Buffer __pyx_pybuffer_x;
5044  PyObject *__pyx_r = NULL;
5045  __Pyx_RefNannyDeclarations
5046  npy_intp __pyx_t_1;
5047  int __pyx_t_2;
5048  Py_ssize_t __pyx_t_3;
5049  int __pyx_t_4;
5050  npy_intp __pyx_t_5;
5051  PyObject *__pyx_t_6 = NULL;
5052  PyObject *__pyx_t_7 = NULL;
5053  PyObject *__pyx_t_8 = NULL;
5054  PyObject *__pyx_t_9 = NULL;
5055  PyObject *__pyx_t_10 = NULL;
5056  Py_ssize_t __pyx_t_11;
5057  PyObject *__pyx_t_12 = NULL;
5058  int __pyx_lineno = 0;
5059  const char *__pyx_filename = NULL;
5060  int __pyx_clineno = 0;
5061  __Pyx_RefNannySetupContext("evaluateVectorMaterialFunctionOverElements", 0);
5062  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
5063  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
5064  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
5065  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
5066  __pyx_pybuffer_x.pybuffer.buf = NULL;
5067  __pyx_pybuffer_x.refcount = 0;
5068  __pyx_pybuffernd_x.data = NULL;
5069  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
5070  __pyx_pybuffer_q_vals.pybuffer.buf = NULL;
5071  __pyx_pybuffer_q_vals.refcount = 0;
5072  __pyx_pybuffernd_q_vals.data = NULL;
5073  __pyx_pybuffernd_q_vals.rcbuffer = &__pyx_pybuffer_q_vals;
5074  {
5075  __Pyx_BufFmt_StackElem __pyx_stack[1];
5076  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5077  }
5078  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
5079  {
5080  __Pyx_BufFmt_StackElem __pyx_stack[1];
5081  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5082  }
5083  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
5084  {
5085  __Pyx_BufFmt_StackElem __pyx_stack[1];
5086  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5087  }
5088  __pyx_pybuffernd_q_vals.diminfo[0].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_vals.diminfo[0].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_vals.diminfo[1].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_vals.diminfo[1].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_vals.diminfo[2].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_vals.diminfo[2].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[2];
5089 
5090  /* "subsurfaceTransportFunctions.pyx":189
5091  * """
5092  * cdef int eN,k,material
5093  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
5094  * material = elementMaterialTypes[eN]
5095  * for k in range(x.shape[1]):
5096  */
5097  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
5098  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
5099  __pyx_v_eN = __pyx_t_2;
5100 
5101  /* "subsurfaceTransportFunctions.pyx":190
5102  * cdef int eN,k,material
5103  * for eN in range(x.shape[0]):
5104  * material = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
5105  * for k in range(x.shape[1]):
5106  * q_vals[eN,k,:] = material_functions[material](x[eN,k],t).flat
5107  */
5108  __pyx_t_3 = __pyx_v_eN;
5109  __pyx_t_4 = -1;
5110  if (__pyx_t_3 < 0) {
5111  __pyx_t_3 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
5112  if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 0;
5113  } else if (unlikely(__pyx_t_3 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_4 = 0;
5114  if (unlikely(__pyx_t_4 != -1)) {
5115  __Pyx_RaiseBufferIndexError(__pyx_t_4);
5116  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5117  }
5118  __pyx_v_material = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
5119 
5120  /* "subsurfaceTransportFunctions.pyx":191
5121  * for eN in range(x.shape[0]):
5122  * material = elementMaterialTypes[eN]
5123  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
5124  * q_vals[eN,k,:] = material_functions[material](x[eN,k],t).flat
5125  *
5126  */
5127  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
5128  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_5; __pyx_t_4+=1) {
5129  __pyx_v_k = __pyx_t_4;
5130 
5131  /* "subsurfaceTransportFunctions.pyx":192
5132  * material = elementMaterialTypes[eN]
5133  * for k in range(x.shape[1]):
5134  * q_vals[eN,k,:] = material_functions[material](x[eN,k],t).flat # <<<<<<<<<<<<<<
5135  *
5136  *
5137  */
5138  if (unlikely(__pyx_v_material_functions == Py_None)) {
5139  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5140  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5141  }
5142  __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_material); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5143  __Pyx_GOTREF(__pyx_t_7);
5144  __pyx_t_8 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_7); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
5145  __Pyx_GOTREF(__pyx_t_8);
5146  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5147  __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5148  __Pyx_GOTREF(__pyx_t_7);
5149  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5150  __Pyx_GOTREF(__pyx_t_9);
5151  __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5152  __Pyx_GOTREF(__pyx_t_10);
5153  __Pyx_GIVEREF(__pyx_t_7);
5154  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_7);
5155  __Pyx_GIVEREF(__pyx_t_9);
5156  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9);
5157  __pyx_t_7 = 0;
5158  __pyx_t_9 = 0;
5159  __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_10); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
5160  __Pyx_GOTREF(__pyx_t_9);
5161  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5162  __pyx_t_10 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5163  __Pyx_GOTREF(__pyx_t_10);
5164  __pyx_t_7 = NULL;
5165  __pyx_t_11 = 0;
5166  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_8))) {
5167  __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
5168  if (likely(__pyx_t_7)) {
5169  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
5170  __Pyx_INCREF(__pyx_t_7);
5171  __Pyx_INCREF(function);
5172  __Pyx_DECREF_SET(__pyx_t_8, function);
5173  __pyx_t_11 = 1;
5174  }
5175  }
5176  __pyx_t_12 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5177  __Pyx_GOTREF(__pyx_t_12);
5178  if (__pyx_t_7) {
5179  __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_7); __pyx_t_7 = NULL;
5180  }
5181  __Pyx_GIVEREF(__pyx_t_9);
5182  PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_t_9);
5183  __Pyx_GIVEREF(__pyx_t_10);
5184  PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_t_10);
5185  __pyx_t_9 = 0;
5186  __pyx_t_10 = 0;
5187  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_12, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5188  __Pyx_GOTREF(__pyx_t_6);
5189  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5190  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5191  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_flat); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5192  __Pyx_GOTREF(__pyx_t_8);
5193  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5194  __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5195  __Pyx_GOTREF(__pyx_t_6);
5196  __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5197  __Pyx_GOTREF(__pyx_t_12);
5198  __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5199  __Pyx_GOTREF(__pyx_t_10);
5200  __Pyx_GIVEREF(__pyx_t_6);
5201  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_6);
5202  __Pyx_GIVEREF(__pyx_t_12);
5203  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_12);
5204  __Pyx_INCREF(__pyx_slice__2);
5205  __Pyx_GIVEREF(__pyx_slice__2);
5206  PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_slice__2);
5207  __pyx_t_6 = 0;
5208  __pyx_t_12 = 0;
5209  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_q_vals), __pyx_t_10, __pyx_t_8) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5210  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5211  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5212  }
5213  }
5214 
5215  /* "subsurfaceTransportFunctions.pyx":180
5216  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
5217  *
5218  * def evaluateVectorMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
5219  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
5220  * numpy.ndarray[DTYPE_t,ndim=3] x,
5221  */
5222 
5223  /* function exit code */
5224  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5225  goto __pyx_L0;
5226  __pyx_L1_error:;
5227  __Pyx_XDECREF(__pyx_t_6);
5228  __Pyx_XDECREF(__pyx_t_7);
5229  __Pyx_XDECREF(__pyx_t_8);
5230  __Pyx_XDECREF(__pyx_t_9);
5231  __Pyx_XDECREF(__pyx_t_10);
5232  __Pyx_XDECREF(__pyx_t_12);
5233  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
5234  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
5235  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
5236  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
5237  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
5238  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
5239  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateVectorMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
5240  __pyx_r = NULL;
5241  goto __pyx_L2;
5242  __pyx_L0:;
5243  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
5244  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
5245  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
5246  __pyx_L2:;
5247  __Pyx_XGIVEREF(__pyx_r);
5248  __Pyx_RefNannyFinishContext();
5249  return __pyx_r;
5250 }
5251 
5252 /* "subsurfaceTransportFunctions.pyx":195
5253  *
5254  *
5255  * def evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
5256  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
5257  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
5258  */
5259 
5260 /* Python wrapper */
5261 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5262 static char __pyx_doc_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage[] = "\n loop over quadrature array and evaluate function f(x,t) = 0.5(f^L_j(x,t)+f^R_k(x,t)) assuming element on left \n is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
5263 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage = {"evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage};
5264 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5265  double __pyx_v_t;
5266  PyArrayObject *__pyx_v_elementBoundariesArray = 0;
5267  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
5268  PyArrayObject *__pyx_v_x = 0;
5269  PyArrayObject *__pyx_v_ebq_vals = 0;
5270  PyObject *__pyx_v_material_functions = 0;
5271  int __pyx_lineno = 0;
5272  const char *__pyx_filename = NULL;
5273  int __pyx_clineno = 0;
5274  PyObject *__pyx_r = 0;
5275  __Pyx_RefNannyDeclarations
5276  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage (wrapper)", 0);
5277  {
5278  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_x,&__pyx_n_s_ebq_vals,&__pyx_n_s_material_functions,0};
5279  PyObject* values[6] = {0,0,0,0,0,0};
5280  if (unlikely(__pyx_kwds)) {
5281  Py_ssize_t kw_args;
5282  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5283  switch (pos_args) {
5284  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
5285  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5286  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5287  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5288  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5289  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5290  case 0: break;
5291  default: goto __pyx_L5_argtuple_error;
5292  }
5293  kw_args = PyDict_Size(__pyx_kwds);
5294  switch (pos_args) {
5295  case 0:
5296  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
5297  else goto __pyx_L5_argtuple_error;
5298  case 1:
5299  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
5300  else {
5301  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5302  }
5303  case 2:
5304  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
5305  else {
5306  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5307  }
5308  case 3:
5309  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
5310  else {
5311  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5312  }
5313  case 4:
5314  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ebq_vals)) != 0)) kw_args--;
5315  else {
5316  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5317  }
5318  case 5:
5319  if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
5320  else {
5321  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5322  }
5323  }
5324  if (unlikely(kw_args > 0)) {
5325  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5326  }
5327  } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
5328  goto __pyx_L5_argtuple_error;
5329  } else {
5330  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5331  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5332  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5333  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5334  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5335  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
5336  }
5337  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5338  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[1]);
5339  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[2]);
5340  __pyx_v_x = ((PyArrayObject *)values[3]);
5341  __pyx_v_ebq_vals = ((PyArrayObject *)values[4]);
5342  __pyx_v_material_functions = ((PyObject*)values[5]);
5343  }
5344  goto __pyx_L4_argument_unpacking_done;
5345  __pyx_L5_argtuple_error:;
5346  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5347  __pyx_L3_error:;
5348  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
5349  __Pyx_RefNannyFinishContext();
5350  return NULL;
5351  __pyx_L4_argument_unpacking_done:;
5352  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5353  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5354  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5355  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_vals", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5356  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5357  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(__pyx_self, __pyx_v_t, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_x, __pyx_v_ebq_vals, __pyx_v_material_functions);
5358 
5359  /* function exit code */
5360  goto __pyx_L0;
5361  __pyx_L1_error:;
5362  __pyx_r = NULL;
5363  __pyx_L0:;
5364  __Pyx_RefNannyFinishContext();
5365  return __pyx_r;
5366 }
5367 
5368 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions) {
5369  int __pyx_v_eN;
5370  int __pyx_v_ebN;
5371  int __pyx_v_ebN_local;
5372  int __pyx_v_k;
5373  int __pyx_v_material_left;
5374  int __pyx_v_material_right;
5375  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_vals;
5376  __Pyx_Buffer __pyx_pybuffer_ebq_vals;
5377  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
5378  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
5379  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
5380  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
5381  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
5382  __Pyx_Buffer __pyx_pybuffer_x;
5383  PyObject *__pyx_r = NULL;
5384  __Pyx_RefNannyDeclarations
5385  npy_intp __pyx_t_1;
5386  int __pyx_t_2;
5387  npy_intp __pyx_t_3;
5388  int __pyx_t_4;
5389  Py_ssize_t __pyx_t_5;
5390  Py_ssize_t __pyx_t_6;
5391  int __pyx_t_7;
5392  Py_ssize_t __pyx_t_8;
5393  Py_ssize_t __pyx_t_9;
5394  Py_ssize_t __pyx_t_10;
5395  Py_ssize_t __pyx_t_11;
5396  npy_intp __pyx_t_12;
5397  PyObject *__pyx_t_13 = NULL;
5398  PyObject *__pyx_t_14 = NULL;
5399  PyObject *__pyx_t_15 = NULL;
5400  PyObject *__pyx_t_16 = NULL;
5401  PyObject *__pyx_t_17 = NULL;
5402  PyObject *__pyx_t_18 = NULL;
5403  Py_ssize_t __pyx_t_19;
5404  PyObject *__pyx_t_20 = NULL;
5405  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_21;
5406  Py_ssize_t __pyx_t_22;
5407  Py_ssize_t __pyx_t_23;
5408  Py_ssize_t __pyx_t_24;
5409  int __pyx_t_25;
5410  int __pyx_lineno = 0;
5411  const char *__pyx_filename = NULL;
5412  int __pyx_clineno = 0;
5413  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 0);
5414  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
5415  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
5416  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
5417  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
5418  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
5419  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
5420  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
5421  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
5422  __pyx_pybuffer_x.pybuffer.buf = NULL;
5423  __pyx_pybuffer_x.refcount = 0;
5424  __pyx_pybuffernd_x.data = NULL;
5425  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
5426  __pyx_pybuffer_ebq_vals.pybuffer.buf = NULL;
5427  __pyx_pybuffer_ebq_vals.refcount = 0;
5428  __pyx_pybuffernd_ebq_vals.data = NULL;
5429  __pyx_pybuffernd_ebq_vals.rcbuffer = &__pyx_pybuffer_ebq_vals;
5430  {
5431  __Pyx_BufFmt_StackElem __pyx_stack[1];
5432  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5433  }
5434  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
5435  {
5436  __Pyx_BufFmt_StackElem __pyx_stack[1];
5437  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5438  }
5439  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
5440  {
5441  __Pyx_BufFmt_StackElem __pyx_stack[1];
5442  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5443  }
5444  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
5445  {
5446  __Pyx_BufFmt_StackElem __pyx_stack[1];
5447  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5448  }
5449  __pyx_pybuffernd_ebq_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[2];
5450 
5451  /* "subsurfaceTransportFunctions.pyx":210
5452  * cdef int eN,ebN,ebN_local,k,material_left,material_right
5453  *
5454  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
5455  * for ebN_local in range(x.shape[1]):
5456  * ebN = elementBoundariesArray[eN,ebN_local]
5457  */
5458  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
5459  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
5460  __pyx_v_eN = __pyx_t_2;
5461 
5462  /* "subsurfaceTransportFunctions.pyx":211
5463  *
5464  * for eN in range(x.shape[0]):
5465  * for ebN_local in range(x.shape[1]): # <<<<<<<<<<<<<<
5466  * ebN = elementBoundariesArray[eN,ebN_local]
5467  * material_left = elementBoundaryTypes[ebN,0]
5468  */
5469  __pyx_t_3 = (__pyx_v_x->dimensions[1]);
5470  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
5471  __pyx_v_ebN_local = __pyx_t_4;
5472 
5473  /* "subsurfaceTransportFunctions.pyx":212
5474  * for eN in range(x.shape[0]):
5475  * for ebN_local in range(x.shape[1]):
5476  * ebN = elementBoundariesArray[eN,ebN_local] # <<<<<<<<<<<<<<
5477  * material_left = elementBoundaryTypes[ebN,0]
5478  * material_right= elementBoundaryTypes[ebN,1]
5479  */
5480  __pyx_t_5 = __pyx_v_eN;
5481  __pyx_t_6 = __pyx_v_ebN_local;
5482  __pyx_t_7 = -1;
5483  if (__pyx_t_5 < 0) {
5484  __pyx_t_5 += __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape;
5485  if (unlikely(__pyx_t_5 < 0)) __pyx_t_7 = 0;
5486  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape)) __pyx_t_7 = 0;
5487  if (__pyx_t_6 < 0) {
5488  __pyx_t_6 += __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape;
5489  if (unlikely(__pyx_t_6 < 0)) __pyx_t_7 = 1;
5490  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape)) __pyx_t_7 = 1;
5491  if (unlikely(__pyx_t_7 != -1)) {
5492  __Pyx_RaiseBufferIndexError(__pyx_t_7);
5493  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5494  }
5495  __pyx_v_ebN = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides));
5496 
5497  /* "subsurfaceTransportFunctions.pyx":213
5498  * for ebN_local in range(x.shape[1]):
5499  * ebN = elementBoundariesArray[eN,ebN_local]
5500  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
5501  * material_right= elementBoundaryTypes[ebN,1]
5502  * for k in range(x.shape[2]):
5503  */
5504  __pyx_t_8 = __pyx_v_ebN;
5505  __pyx_t_9 = 0;
5506  __pyx_t_7 = -1;
5507  if (__pyx_t_8 < 0) {
5508  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
5509  if (unlikely(__pyx_t_8 < 0)) __pyx_t_7 = 0;
5510  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_7 = 0;
5511  if (__pyx_t_9 < 0) {
5512  __pyx_t_9 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
5513  if (unlikely(__pyx_t_9 < 0)) __pyx_t_7 = 1;
5514  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_7 = 1;
5515  if (unlikely(__pyx_t_7 != -1)) {
5516  __Pyx_RaiseBufferIndexError(__pyx_t_7);
5517  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5518  }
5519  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
5520 
5521  /* "subsurfaceTransportFunctions.pyx":214
5522  * ebN = elementBoundariesArray[eN,ebN_local]
5523  * material_left = elementBoundaryTypes[ebN,0]
5524  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
5525  * for k in range(x.shape[2]):
5526  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+
5527  */
5528  __pyx_t_10 = __pyx_v_ebN;
5529  __pyx_t_11 = 1;
5530  __pyx_t_7 = -1;
5531  if (__pyx_t_10 < 0) {
5532  __pyx_t_10 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
5533  if (unlikely(__pyx_t_10 < 0)) __pyx_t_7 = 0;
5534  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_7 = 0;
5535  if (__pyx_t_11 < 0) {
5536  __pyx_t_11 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
5537  if (unlikely(__pyx_t_11 < 0)) __pyx_t_7 = 1;
5538  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_7 = 1;
5539  if (unlikely(__pyx_t_7 != -1)) {
5540  __Pyx_RaiseBufferIndexError(__pyx_t_7);
5541  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5542  }
5543  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
5544 
5545  /* "subsurfaceTransportFunctions.pyx":215
5546  * material_left = elementBoundaryTypes[ebN,0]
5547  * material_right= elementBoundaryTypes[ebN,1]
5548  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
5549  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+
5550  * material_functions[material_right](x[eN,ebN_local,k],t))
5551  */
5552  __pyx_t_12 = (__pyx_v_x->dimensions[2]);
5553  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_12; __pyx_t_7+=1) {
5554  __pyx_v_k = __pyx_t_7;
5555 
5556  /* "subsurfaceTransportFunctions.pyx":216
5557  * material_right= elementBoundaryTypes[ebN,1]
5558  * for k in range(x.shape[2]):
5559  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+ # <<<<<<<<<<<<<<
5560  * material_functions[material_right](x[eN,ebN_local,k],t))
5561  *
5562  */
5563  if (unlikely(__pyx_v_material_functions == Py_None)) {
5564  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5565  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5566  }
5567  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5568  __Pyx_GOTREF(__pyx_t_14);
5569  __pyx_t_15 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_14); if (unlikely(__pyx_t_15 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
5570  __Pyx_GOTREF(__pyx_t_15);
5571  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
5572  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5573  __Pyx_GOTREF(__pyx_t_14);
5574  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5575  __Pyx_GOTREF(__pyx_t_16);
5576  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5577  __Pyx_GOTREF(__pyx_t_17);
5578  __pyx_t_18 = PyTuple_New(3); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5579  __Pyx_GOTREF(__pyx_t_18);
5580  __Pyx_GIVEREF(__pyx_t_14);
5581  PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_14);
5582  __Pyx_GIVEREF(__pyx_t_16);
5583  PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_16);
5584  __Pyx_GIVEREF(__pyx_t_17);
5585  PyTuple_SET_ITEM(__pyx_t_18, 2, __pyx_t_17);
5586  __pyx_t_14 = 0;
5587  __pyx_t_16 = 0;
5588  __pyx_t_17 = 0;
5589  __pyx_t_17 = PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_18); if (unlikely(__pyx_t_17 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
5590  __Pyx_GOTREF(__pyx_t_17);
5591  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
5592  __pyx_t_18 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5593  __Pyx_GOTREF(__pyx_t_18);
5594  __pyx_t_16 = NULL;
5595  __pyx_t_19 = 0;
5596  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_15))) {
5597  __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_15);
5598  if (likely(__pyx_t_16)) {
5599  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
5600  __Pyx_INCREF(__pyx_t_16);
5601  __Pyx_INCREF(function);
5602  __Pyx_DECREF_SET(__pyx_t_15, function);
5603  __pyx_t_19 = 1;
5604  }
5605  }
5606  __pyx_t_14 = PyTuple_New(2+__pyx_t_19); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5607  __Pyx_GOTREF(__pyx_t_14);
5608  if (__pyx_t_16) {
5609  __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_16); __pyx_t_16 = NULL;
5610  }
5611  __Pyx_GIVEREF(__pyx_t_17);
5612  PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_19, __pyx_t_17);
5613  __Pyx_GIVEREF(__pyx_t_18);
5614  PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_19, __pyx_t_18);
5615  __pyx_t_17 = 0;
5616  __pyx_t_18 = 0;
5617  __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_14, NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5618  __Pyx_GOTREF(__pyx_t_13);
5619  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
5620  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
5621 
5622  /* "subsurfaceTransportFunctions.pyx":217
5623  * for k in range(x.shape[2]):
5624  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+
5625  * material_functions[material_right](x[eN,ebN_local,k],t)) # <<<<<<<<<<<<<<
5626  *
5627  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd,
5628  */
5629  if (unlikely(__pyx_v_material_functions == Py_None)) {
5630  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5631  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5632  }
5633  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5634  __Pyx_GOTREF(__pyx_t_14);
5635  __pyx_t_18 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_14); if (unlikely(__pyx_t_18 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
5636  __Pyx_GOTREF(__pyx_t_18);
5637  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
5638  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5639  __Pyx_GOTREF(__pyx_t_14);
5640  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5641  __Pyx_GOTREF(__pyx_t_17);
5642  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5643  __Pyx_GOTREF(__pyx_t_16);
5644  __pyx_t_20 = PyTuple_New(3); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5645  __Pyx_GOTREF(__pyx_t_20);
5646  __Pyx_GIVEREF(__pyx_t_14);
5647  PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_14);
5648  __Pyx_GIVEREF(__pyx_t_17);
5649  PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_t_17);
5650  __Pyx_GIVEREF(__pyx_t_16);
5651  PyTuple_SET_ITEM(__pyx_t_20, 2, __pyx_t_16);
5652  __pyx_t_14 = 0;
5653  __pyx_t_17 = 0;
5654  __pyx_t_16 = 0;
5655  __pyx_t_16 = PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_20); if (unlikely(__pyx_t_16 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
5656  __Pyx_GOTREF(__pyx_t_16);
5657  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
5658  __pyx_t_20 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5659  __Pyx_GOTREF(__pyx_t_20);
5660  __pyx_t_17 = NULL;
5661  __pyx_t_19 = 0;
5662  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_18))) {
5663  __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_18);
5664  if (likely(__pyx_t_17)) {
5665  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18);
5666  __Pyx_INCREF(__pyx_t_17);
5667  __Pyx_INCREF(function);
5668  __Pyx_DECREF_SET(__pyx_t_18, function);
5669  __pyx_t_19 = 1;
5670  }
5671  }
5672  __pyx_t_14 = PyTuple_New(2+__pyx_t_19); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5673  __Pyx_GOTREF(__pyx_t_14);
5674  if (__pyx_t_17) {
5675  __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_17); __pyx_t_17 = NULL;
5676  }
5677  __Pyx_GIVEREF(__pyx_t_16);
5678  PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_19, __pyx_t_16);
5679  __Pyx_GIVEREF(__pyx_t_20);
5680  PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_19, __pyx_t_20);
5681  __pyx_t_16 = 0;
5682  __pyx_t_20 = 0;
5683  __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_18, __pyx_t_14, NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5684  __Pyx_GOTREF(__pyx_t_15);
5685  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
5686  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
5687 
5688  /* "subsurfaceTransportFunctions.pyx":216
5689  * material_right= elementBoundaryTypes[ebN,1]
5690  * for k in range(x.shape[2]):
5691  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+ # <<<<<<<<<<<<<<
5692  * material_functions[material_right](x[eN,ebN_local,k],t))
5693  *
5694  */
5695  __pyx_t_18 = PyNumber_Add(__pyx_t_13, __pyx_t_15); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5696  __Pyx_GOTREF(__pyx_t_18);
5697  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
5698  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
5699  __pyx_t_15 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_18); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5700  __Pyx_GOTREF(__pyx_t_15);
5701  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
5702  __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_t_15); if (unlikely((__pyx_t_21 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5703  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
5704  __pyx_t_22 = __pyx_v_eN;
5705  __pyx_t_23 = __pyx_v_ebN_local;
5706  __pyx_t_24 = __pyx_v_k;
5707  __pyx_t_25 = -1;
5708  if (__pyx_t_22 < 0) {
5709  __pyx_t_22 += __pyx_pybuffernd_ebq_vals.diminfo[0].shape;
5710  if (unlikely(__pyx_t_22 < 0)) __pyx_t_25 = 0;
5711  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_ebq_vals.diminfo[0].shape)) __pyx_t_25 = 0;
5712  if (__pyx_t_23 < 0) {
5713  __pyx_t_23 += __pyx_pybuffernd_ebq_vals.diminfo[1].shape;
5714  if (unlikely(__pyx_t_23 < 0)) __pyx_t_25 = 1;
5715  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_ebq_vals.diminfo[1].shape)) __pyx_t_25 = 1;
5716  if (__pyx_t_24 < 0) {
5717  __pyx_t_24 += __pyx_pybuffernd_ebq_vals.diminfo[2].shape;
5718  if (unlikely(__pyx_t_24 < 0)) __pyx_t_25 = 2;
5719  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_ebq_vals.diminfo[2].shape)) __pyx_t_25 = 2;
5720  if (unlikely(__pyx_t_25 != -1)) {
5721  __Pyx_RaiseBufferIndexError(__pyx_t_25);
5722  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5723  }
5724  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_ebq_vals.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_ebq_vals.diminfo[1].strides, __pyx_t_24, __pyx_pybuffernd_ebq_vals.diminfo[2].strides) = __pyx_t_21;
5725  }
5726  }
5727  }
5728 
5729  /* "subsurfaceTransportFunctions.pyx":195
5730  *
5731  *
5732  * def evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
5733  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
5734  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
5735  */
5736 
5737  /* function exit code */
5738  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5739  goto __pyx_L0;
5740  __pyx_L1_error:;
5741  __Pyx_XDECREF(__pyx_t_13);
5742  __Pyx_XDECREF(__pyx_t_14);
5743  __Pyx_XDECREF(__pyx_t_15);
5744  __Pyx_XDECREF(__pyx_t_16);
5745  __Pyx_XDECREF(__pyx_t_17);
5746  __Pyx_XDECREF(__pyx_t_18);
5747  __Pyx_XDECREF(__pyx_t_20);
5748  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
5749  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
5750  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
5751  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
5752  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
5753  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
5754  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
5755  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
5756  __pyx_r = NULL;
5757  goto __pyx_L2;
5758  __pyx_L0:;
5759  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
5760  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
5761  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
5762  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
5763  __pyx_L2:;
5764  __Pyx_XGIVEREF(__pyx_r);
5765  __Pyx_RefNannyFinishContext();
5766  return __pyx_r;
5767 }
5768 
5769 /* "subsurfaceTransportFunctions.pyx":219
5770  * material_functions[material_right](x[eN,ebN_local,k],t))
5771  *
5772  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
5773  * double t,
5774  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
5775  */
5776 
5777 /* Python wrapper */
5778 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5779 static char __pyx_doc_28subsurfaceTransportFunctions_22evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage[] = "\n loop over quadrature array and evaluate function \ten f_{mn}(x,t) = f^L_{j,mn}(x,t)f^R_{k,mn}(x,t)/(f^L_{j,mn}(x,t)+f^R_{k,mn})\n assuming element on left is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
5780 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage = {"evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_22evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage};
5781 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5782  int __pyx_v_nd;
5783  double __pyx_v_t;
5784  PyArrayObject *__pyx_v_elementBoundariesArray = 0;
5785  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
5786  PyArrayObject *__pyx_v_x = 0;
5787  PyArrayObject *__pyx_v_ebq_vals = 0;
5788  PyObject *__pyx_v_material_functions = 0;
5789  int __pyx_lineno = 0;
5790  const char *__pyx_filename = NULL;
5791  int __pyx_clineno = 0;
5792  PyObject *__pyx_r = 0;
5793  __Pyx_RefNannyDeclarations
5794  __Pyx_RefNannySetupContext("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage (wrapper)", 0);
5795  {
5796  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nd,&__pyx_n_s_t,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_x,&__pyx_n_s_ebq_vals,&__pyx_n_s_material_functions,0};
5797  PyObject* values[7] = {0,0,0,0,0,0,0};
5798  if (unlikely(__pyx_kwds)) {
5799  Py_ssize_t kw_args;
5800  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5801  switch (pos_args) {
5802  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
5803  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
5804  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5805  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5806  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5807  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5808  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5809  case 0: break;
5810  default: goto __pyx_L5_argtuple_error;
5811  }
5812  kw_args = PyDict_Size(__pyx_kwds);
5813  switch (pos_args) {
5814  case 0:
5815  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
5816  else goto __pyx_L5_argtuple_error;
5817  case 1:
5818  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
5819  else {
5820  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5821  }
5822  case 2:
5823  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
5824  else {
5825  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5826  }
5827  case 3:
5828  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
5829  else {
5830  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5831  }
5832  case 4:
5833  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
5834  else {
5835  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5836  }
5837  case 5:
5838  if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ebq_vals)) != 0)) kw_args--;
5839  else {
5840  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5841  }
5842  case 6:
5843  if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
5844  else {
5845  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5846  }
5847  }
5848  if (unlikely(kw_args > 0)) {
5849  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5850  }
5851  } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
5852  goto __pyx_L5_argtuple_error;
5853  } else {
5854  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5855  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5856  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5857  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5858  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5859  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
5860  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
5861  }
5862  __pyx_v_nd = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5863  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5864  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[2]);
5865  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[3]);
5866  __pyx_v_x = ((PyArrayObject *)values[4]);
5867  __pyx_v_ebq_vals = ((PyArrayObject *)values[5]);
5868  __pyx_v_material_functions = ((PyObject*)values[6]);
5869  }
5870  goto __pyx_L4_argument_unpacking_done;
5871  __pyx_L5_argtuple_error:;
5872  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5873  __pyx_L3_error:;
5874  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
5875  __Pyx_RefNannyFinishContext();
5876  return NULL;
5877  __pyx_L4_argument_unpacking_done:;
5878  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5879  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5880  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5881  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_vals", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5882  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5883  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_22evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(__pyx_self, __pyx_v_nd, __pyx_v_t, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_x, __pyx_v_ebq_vals, __pyx_v_material_functions);
5884 
5885  /* function exit code */
5886  goto __pyx_L0;
5887  __pyx_L1_error:;
5888  __pyx_r = NULL;
5889  __pyx_L0:;
5890  __Pyx_RefNannyFinishContext();
5891  return __pyx_r;
5892 }
5893 
5894 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_22evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, double __pyx_v_t, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions) {
5895  int __pyx_v_eN;
5896  int __pyx_v_ebN;
5897  int __pyx_v_ebN_local;
5898  int __pyx_v_k;
5899  int __pyx_v_material_left;
5900  int __pyx_v_material_right;
5901  int __pyx_v_I;
5902  int __pyx_v_J;
5903  double __pyx_v_numer;
5904  double __pyx_v_denom;
5905  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_vals;
5906  __Pyx_Buffer __pyx_pybuffer_ebq_vals;
5907  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
5908  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
5909  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
5910  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
5911  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
5912  __Pyx_Buffer __pyx_pybuffer_x;
5913  PyObject *__pyx_r = NULL;
5914  __Pyx_RefNannyDeclarations
5915  npy_intp __pyx_t_1;
5916  int __pyx_t_2;
5917  npy_intp __pyx_t_3;
5918  int __pyx_t_4;
5919  Py_ssize_t __pyx_t_5;
5920  Py_ssize_t __pyx_t_6;
5921  int __pyx_t_7;
5922  Py_ssize_t __pyx_t_8;
5923  Py_ssize_t __pyx_t_9;
5924  Py_ssize_t __pyx_t_10;
5925  Py_ssize_t __pyx_t_11;
5926  npy_intp __pyx_t_12;
5927  int __pyx_t_13;
5928  int __pyx_t_14;
5929  int __pyx_t_15;
5930  int __pyx_t_16;
5931  PyObject *__pyx_t_17 = NULL;
5932  PyObject *__pyx_t_18 = NULL;
5933  PyObject *__pyx_t_19 = NULL;
5934  PyObject *__pyx_t_20 = NULL;
5935  PyObject *__pyx_t_21 = NULL;
5936  PyObject *__pyx_t_22 = NULL;
5937  Py_ssize_t __pyx_t_23;
5938  PyObject *__pyx_t_24 = NULL;
5939  double __pyx_t_25;
5940  Py_ssize_t __pyx_t_26;
5941  Py_ssize_t __pyx_t_27;
5942  Py_ssize_t __pyx_t_28;
5943  Py_ssize_t __pyx_t_29;
5944  int __pyx_t_30;
5945  int __pyx_lineno = 0;
5946  const char *__pyx_filename = NULL;
5947  int __pyx_clineno = 0;
5948  __Pyx_RefNannySetupContext("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 0);
5949  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
5950  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
5951  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
5952  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
5953  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
5954  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
5955  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
5956  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
5957  __pyx_pybuffer_x.pybuffer.buf = NULL;
5958  __pyx_pybuffer_x.refcount = 0;
5959  __pyx_pybuffernd_x.data = NULL;
5960  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
5961  __pyx_pybuffer_ebq_vals.pybuffer.buf = NULL;
5962  __pyx_pybuffer_ebq_vals.refcount = 0;
5963  __pyx_pybuffernd_ebq_vals.data = NULL;
5964  __pyx_pybuffernd_ebq_vals.rcbuffer = &__pyx_pybuffer_ebq_vals;
5965  {
5966  __Pyx_BufFmt_StackElem __pyx_stack[1];
5967  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5968  }
5969  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
5970  {
5971  __Pyx_BufFmt_StackElem __pyx_stack[1];
5972  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5973  }
5974  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
5975  {
5976  __Pyx_BufFmt_StackElem __pyx_stack[1];
5977  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5978  }
5979  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
5980  {
5981  __Pyx_BufFmt_StackElem __pyx_stack[1];
5982  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5983  }
5984  __pyx_pybuffernd_ebq_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_ebq_vals.diminfo[3].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_ebq_vals.diminfo[3].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[3];
5985 
5986  /* "subsurfaceTransportFunctions.pyx":236
5987  * cdef double numer,denom
5988  *
5989  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
5990  * for ebN_local in range(x.shape[1]):
5991  * ebN = elementBoundariesArray[eN,ebN_local]
5992  */
5993  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
5994  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
5995  __pyx_v_eN = __pyx_t_2;
5996 
5997  /* "subsurfaceTransportFunctions.pyx":237
5998  *
5999  * for eN in range(x.shape[0]):
6000  * for ebN_local in range(x.shape[1]): # <<<<<<<<<<<<<<
6001  * ebN = elementBoundariesArray[eN,ebN_local]
6002  * material_left = elementBoundaryTypes[ebN,0]
6003  */
6004  __pyx_t_3 = (__pyx_v_x->dimensions[1]);
6005  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
6006  __pyx_v_ebN_local = __pyx_t_4;
6007 
6008  /* "subsurfaceTransportFunctions.pyx":238
6009  * for eN in range(x.shape[0]):
6010  * for ebN_local in range(x.shape[1]):
6011  * ebN = elementBoundariesArray[eN,ebN_local] # <<<<<<<<<<<<<<
6012  * material_left = elementBoundaryTypes[ebN,0]
6013  * material_right= elementBoundaryTypes[ebN,1]
6014  */
6015  __pyx_t_5 = __pyx_v_eN;
6016  __pyx_t_6 = __pyx_v_ebN_local;
6017  __pyx_t_7 = -1;
6018  if (__pyx_t_5 < 0) {
6019  __pyx_t_5 += __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape;
6020  if (unlikely(__pyx_t_5 < 0)) __pyx_t_7 = 0;
6021  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape)) __pyx_t_7 = 0;
6022  if (__pyx_t_6 < 0) {
6023  __pyx_t_6 += __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape;
6024  if (unlikely(__pyx_t_6 < 0)) __pyx_t_7 = 1;
6025  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape)) __pyx_t_7 = 1;
6026  if (unlikely(__pyx_t_7 != -1)) {
6027  __Pyx_RaiseBufferIndexError(__pyx_t_7);
6028  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6029  }
6030  __pyx_v_ebN = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides));
6031 
6032  /* "subsurfaceTransportFunctions.pyx":239
6033  * for ebN_local in range(x.shape[1]):
6034  * ebN = elementBoundariesArray[eN,ebN_local]
6035  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
6036  * material_right= elementBoundaryTypes[ebN,1]
6037  * for k in range(x.shape[2]):
6038  */
6039  __pyx_t_8 = __pyx_v_ebN;
6040  __pyx_t_9 = 0;
6041  __pyx_t_7 = -1;
6042  if (__pyx_t_8 < 0) {
6043  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
6044  if (unlikely(__pyx_t_8 < 0)) __pyx_t_7 = 0;
6045  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_7 = 0;
6046  if (__pyx_t_9 < 0) {
6047  __pyx_t_9 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
6048  if (unlikely(__pyx_t_9 < 0)) __pyx_t_7 = 1;
6049  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_7 = 1;
6050  if (unlikely(__pyx_t_7 != -1)) {
6051  __Pyx_RaiseBufferIndexError(__pyx_t_7);
6052  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6053  }
6054  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
6055 
6056  /* "subsurfaceTransportFunctions.pyx":240
6057  * ebN = elementBoundariesArray[eN,ebN_local]
6058  * material_left = elementBoundaryTypes[ebN,0]
6059  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
6060  * for k in range(x.shape[2]):
6061  * for I in range(nd):
6062  */
6063  __pyx_t_10 = __pyx_v_ebN;
6064  __pyx_t_11 = 1;
6065  __pyx_t_7 = -1;
6066  if (__pyx_t_10 < 0) {
6067  __pyx_t_10 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
6068  if (unlikely(__pyx_t_10 < 0)) __pyx_t_7 = 0;
6069  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_7 = 0;
6070  if (__pyx_t_11 < 0) {
6071  __pyx_t_11 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
6072  if (unlikely(__pyx_t_11 < 0)) __pyx_t_7 = 1;
6073  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_7 = 1;
6074  if (unlikely(__pyx_t_7 != -1)) {
6075  __Pyx_RaiseBufferIndexError(__pyx_t_7);
6076  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6077  }
6078  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
6079 
6080  /* "subsurfaceTransportFunctions.pyx":241
6081  * material_left = elementBoundaryTypes[ebN,0]
6082  * material_right= elementBoundaryTypes[ebN,1]
6083  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
6084  * for I in range(nd):
6085  * for J in range(nd):
6086  */
6087  __pyx_t_12 = (__pyx_v_x->dimensions[2]);
6088  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_12; __pyx_t_7+=1) {
6089  __pyx_v_k = __pyx_t_7;
6090 
6091  /* "subsurfaceTransportFunctions.pyx":242
6092  * material_right= elementBoundaryTypes[ebN,1]
6093  * for k in range(x.shape[2]):
6094  * for I in range(nd): # <<<<<<<<<<<<<<
6095  * for J in range(nd):
6096  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J]
6097  */
6098  __pyx_t_13 = __pyx_v_nd;
6099  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
6100  __pyx_v_I = __pyx_t_14;
6101 
6102  /* "subsurfaceTransportFunctions.pyx":243
6103  * for k in range(x.shape[2]):
6104  * for I in range(nd):
6105  * for J in range(nd): # <<<<<<<<<<<<<<
6106  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J]
6107  * denom = material_functions[material_left](x[eN,ebN_local,k],t)[I,J] + material_functions[material_right](x[eN,ebN_local,k],t)[I,J] + 1.0e-20
6108  */
6109  __pyx_t_15 = __pyx_v_nd;
6110  for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
6111  __pyx_v_J = __pyx_t_16;
6112 
6113  /* "subsurfaceTransportFunctions.pyx":244
6114  * for I in range(nd):
6115  * for J in range(nd):
6116  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J] # <<<<<<<<<<<<<<
6117  * denom = material_functions[material_left](x[eN,ebN_local,k],t)[I,J] + material_functions[material_right](x[eN,ebN_local,k],t)[I,J] + 1.0e-20
6118  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
6119  */
6120  if (unlikely(__pyx_v_material_functions == Py_None)) {
6121  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6122  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6123  }
6124  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6125  __Pyx_GOTREF(__pyx_t_18);
6126  __pyx_t_19 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_18); if (unlikely(__pyx_t_19 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
6127  __Pyx_GOTREF(__pyx_t_19);
6128  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
6129  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6130  __Pyx_GOTREF(__pyx_t_18);
6131  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6132  __Pyx_GOTREF(__pyx_t_20);
6133  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6134  __Pyx_GOTREF(__pyx_t_21);
6135  __pyx_t_22 = PyTuple_New(3); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6136  __Pyx_GOTREF(__pyx_t_22);
6137  __Pyx_GIVEREF(__pyx_t_18);
6138  PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_18);
6139  __Pyx_GIVEREF(__pyx_t_20);
6140  PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_20);
6141  __Pyx_GIVEREF(__pyx_t_21);
6142  PyTuple_SET_ITEM(__pyx_t_22, 2, __pyx_t_21);
6143  __pyx_t_18 = 0;
6144  __pyx_t_20 = 0;
6145  __pyx_t_21 = 0;
6146  __pyx_t_21 = PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_22); if (unlikely(__pyx_t_21 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
6147  __Pyx_GOTREF(__pyx_t_21);
6148  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
6149  __pyx_t_22 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6150  __Pyx_GOTREF(__pyx_t_22);
6151  __pyx_t_20 = NULL;
6152  __pyx_t_23 = 0;
6153  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_19))) {
6154  __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_19);
6155  if (likely(__pyx_t_20)) {
6156  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19);
6157  __Pyx_INCREF(__pyx_t_20);
6158  __Pyx_INCREF(function);
6159  __Pyx_DECREF_SET(__pyx_t_19, function);
6160  __pyx_t_23 = 1;
6161  }
6162  }
6163  __pyx_t_18 = PyTuple_New(2+__pyx_t_23); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6164  __Pyx_GOTREF(__pyx_t_18);
6165  if (__pyx_t_20) {
6166  __Pyx_GIVEREF(__pyx_t_20); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_20); __pyx_t_20 = NULL;
6167  }
6168  __Pyx_GIVEREF(__pyx_t_21);
6169  PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_23, __pyx_t_21);
6170  __Pyx_GIVEREF(__pyx_t_22);
6171  PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_23, __pyx_t_22);
6172  __pyx_t_21 = 0;
6173  __pyx_t_22 = 0;
6174  __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_19, __pyx_t_18, NULL); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6175  __Pyx_GOTREF(__pyx_t_17);
6176  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
6177  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
6178  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6179  __Pyx_GOTREF(__pyx_t_19);
6180  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6181  __Pyx_GOTREF(__pyx_t_18);
6182  __pyx_t_22 = PyTuple_New(2); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6183  __Pyx_GOTREF(__pyx_t_22);
6184  __Pyx_GIVEREF(__pyx_t_19);
6185  PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_19);
6186  __Pyx_GIVEREF(__pyx_t_18);
6187  PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_18);
6188  __pyx_t_19 = 0;
6189  __pyx_t_18 = 0;
6190  __pyx_t_18 = PyObject_GetItem(__pyx_t_17, __pyx_t_22); if (unlikely(__pyx_t_18 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
6191  __Pyx_GOTREF(__pyx_t_18);
6192  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6193  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
6194  __pyx_t_22 = PyNumber_Multiply(__pyx_float_2_0, __pyx_t_18); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6195  __Pyx_GOTREF(__pyx_t_22);
6196  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
6197  if (unlikely(__pyx_v_material_functions == Py_None)) {
6198  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6199  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6200  }
6201  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6202  __Pyx_GOTREF(__pyx_t_17);
6203  __pyx_t_19 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_17); if (unlikely(__pyx_t_19 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
6204  __Pyx_GOTREF(__pyx_t_19);
6205  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6206  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6207  __Pyx_GOTREF(__pyx_t_17);
6208  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6209  __Pyx_GOTREF(__pyx_t_21);
6210  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6211  __Pyx_GOTREF(__pyx_t_20);
6212  __pyx_t_24 = PyTuple_New(3); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6213  __Pyx_GOTREF(__pyx_t_24);
6214  __Pyx_GIVEREF(__pyx_t_17);
6215  PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_17);
6216  __Pyx_GIVEREF(__pyx_t_21);
6217  PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_t_21);
6218  __Pyx_GIVEREF(__pyx_t_20);
6219  PyTuple_SET_ITEM(__pyx_t_24, 2, __pyx_t_20);
6220  __pyx_t_17 = 0;
6221  __pyx_t_21 = 0;
6222  __pyx_t_20 = 0;
6223  __pyx_t_20 = PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_24); if (unlikely(__pyx_t_20 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
6224  __Pyx_GOTREF(__pyx_t_20);
6225  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
6226  __pyx_t_24 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6227  __Pyx_GOTREF(__pyx_t_24);
6228  __pyx_t_21 = NULL;
6229  __pyx_t_23 = 0;
6230  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_19))) {
6231  __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_19);
6232  if (likely(__pyx_t_21)) {
6233  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19);
6234  __Pyx_INCREF(__pyx_t_21);
6235  __Pyx_INCREF(function);
6236  __Pyx_DECREF_SET(__pyx_t_19, function);
6237  __pyx_t_23 = 1;
6238  }
6239  }
6240  __pyx_t_17 = PyTuple_New(2+__pyx_t_23); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6241  __Pyx_GOTREF(__pyx_t_17);
6242  if (__pyx_t_21) {
6243  __Pyx_GIVEREF(__pyx_t_21); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_21); __pyx_t_21 = NULL;
6244  }
6245  __Pyx_GIVEREF(__pyx_t_20);
6246  PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_23, __pyx_t_20);
6247  __Pyx_GIVEREF(__pyx_t_24);
6248  PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_23, __pyx_t_24);
6249  __pyx_t_20 = 0;
6250  __pyx_t_24 = 0;
6251  __pyx_t_18 = __Pyx_PyObject_Call(__pyx_t_19, __pyx_t_17, NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6252  __Pyx_GOTREF(__pyx_t_18);
6253  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6254  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
6255  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6256  __Pyx_GOTREF(__pyx_t_19);
6257  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6258  __Pyx_GOTREF(__pyx_t_17);
6259  __pyx_t_24 = PyTuple_New(2); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6260  __Pyx_GOTREF(__pyx_t_24);
6261  __Pyx_GIVEREF(__pyx_t_19);
6262  PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_19);
6263  __Pyx_GIVEREF(__pyx_t_17);
6264  PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_t_17);
6265  __pyx_t_19 = 0;
6266  __pyx_t_17 = 0;
6267  __pyx_t_17 = PyObject_GetItem(__pyx_t_18, __pyx_t_24); if (unlikely(__pyx_t_17 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
6268  __Pyx_GOTREF(__pyx_t_17);
6269  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
6270  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
6271  __pyx_t_24 = PyNumber_Multiply(__pyx_t_22, __pyx_t_17); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6272  __Pyx_GOTREF(__pyx_t_24);
6273  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
6274  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6275  __pyx_t_25 = __pyx_PyFloat_AsDouble(__pyx_t_24); if (unlikely((__pyx_t_25 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6276  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
6277  __pyx_v_numer = __pyx_t_25;
6278 
6279  /* "subsurfaceTransportFunctions.pyx":245
6280  * for J in range(nd):
6281  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J]
6282  * denom = material_functions[material_left](x[eN,ebN_local,k],t)[I,J] + material_functions[material_right](x[eN,ebN_local,k],t)[I,J] + 1.0e-20 # <<<<<<<<<<<<<<
6283  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
6284  *
6285  */
6286  if (unlikely(__pyx_v_material_functions == Py_None)) {
6287  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6288  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6289  }
6290  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6291  __Pyx_GOTREF(__pyx_t_17);
6292  __pyx_t_22 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_17); if (unlikely(__pyx_t_22 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
6293  __Pyx_GOTREF(__pyx_t_22);
6294  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6295  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6296  __Pyx_GOTREF(__pyx_t_17);
6297  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6298  __Pyx_GOTREF(__pyx_t_18);
6299  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6300  __Pyx_GOTREF(__pyx_t_19);
6301  __pyx_t_20 = PyTuple_New(3); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6302  __Pyx_GOTREF(__pyx_t_20);
6303  __Pyx_GIVEREF(__pyx_t_17);
6304  PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_17);
6305  __Pyx_GIVEREF(__pyx_t_18);
6306  PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_t_18);
6307  __Pyx_GIVEREF(__pyx_t_19);
6308  PyTuple_SET_ITEM(__pyx_t_20, 2, __pyx_t_19);
6309  __pyx_t_17 = 0;
6310  __pyx_t_18 = 0;
6311  __pyx_t_19 = 0;
6312  __pyx_t_19 = PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_20); if (unlikely(__pyx_t_19 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
6313  __Pyx_GOTREF(__pyx_t_19);
6314  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
6315  __pyx_t_20 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6316  __Pyx_GOTREF(__pyx_t_20);
6317  __pyx_t_18 = NULL;
6318  __pyx_t_23 = 0;
6319  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_22))) {
6320  __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_22);
6321  if (likely(__pyx_t_18)) {
6322  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_22);
6323  __Pyx_INCREF(__pyx_t_18);
6324  __Pyx_INCREF(function);
6325  __Pyx_DECREF_SET(__pyx_t_22, function);
6326  __pyx_t_23 = 1;
6327  }
6328  }
6329  __pyx_t_17 = PyTuple_New(2+__pyx_t_23); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6330  __Pyx_GOTREF(__pyx_t_17);
6331  if (__pyx_t_18) {
6332  __Pyx_GIVEREF(__pyx_t_18); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_18); __pyx_t_18 = NULL;
6333  }
6334  __Pyx_GIVEREF(__pyx_t_19);
6335  PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_23, __pyx_t_19);
6336  __Pyx_GIVEREF(__pyx_t_20);
6337  PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_23, __pyx_t_20);
6338  __pyx_t_19 = 0;
6339  __pyx_t_20 = 0;
6340  __pyx_t_24 = __Pyx_PyObject_Call(__pyx_t_22, __pyx_t_17, NULL); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6341  __Pyx_GOTREF(__pyx_t_24);
6342  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6343  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
6344  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6345  __Pyx_GOTREF(__pyx_t_22);
6346  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6347  __Pyx_GOTREF(__pyx_t_17);
6348  __pyx_t_20 = PyTuple_New(2); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6349  __Pyx_GOTREF(__pyx_t_20);
6350  __Pyx_GIVEREF(__pyx_t_22);
6351  PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_22);
6352  __Pyx_GIVEREF(__pyx_t_17);
6353  PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_t_17);
6354  __pyx_t_22 = 0;
6355  __pyx_t_17 = 0;
6356  __pyx_t_17 = PyObject_GetItem(__pyx_t_24, __pyx_t_20); if (unlikely(__pyx_t_17 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
6357  __Pyx_GOTREF(__pyx_t_17);
6358  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
6359  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
6360  if (unlikely(__pyx_v_material_functions == Py_None)) {
6361  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6362  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6363  }
6364  __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6365  __Pyx_GOTREF(__pyx_t_24);
6366  __pyx_t_22 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_24); if (unlikely(__pyx_t_22 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
6367  __Pyx_GOTREF(__pyx_t_22);
6368  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
6369  __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6370  __Pyx_GOTREF(__pyx_t_24);
6371  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6372  __Pyx_GOTREF(__pyx_t_19);
6373  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6374  __Pyx_GOTREF(__pyx_t_18);
6375  __pyx_t_21 = PyTuple_New(3); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6376  __Pyx_GOTREF(__pyx_t_21);
6377  __Pyx_GIVEREF(__pyx_t_24);
6378  PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_24);
6379  __Pyx_GIVEREF(__pyx_t_19);
6380  PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_19);
6381  __Pyx_GIVEREF(__pyx_t_18);
6382  PyTuple_SET_ITEM(__pyx_t_21, 2, __pyx_t_18);
6383  __pyx_t_24 = 0;
6384  __pyx_t_19 = 0;
6385  __pyx_t_18 = 0;
6386  __pyx_t_18 = PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_21); if (unlikely(__pyx_t_18 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
6387  __Pyx_GOTREF(__pyx_t_18);
6388  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
6389  __pyx_t_21 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6390  __Pyx_GOTREF(__pyx_t_21);
6391  __pyx_t_19 = NULL;
6392  __pyx_t_23 = 0;
6393  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_22))) {
6394  __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_22);
6395  if (likely(__pyx_t_19)) {
6396  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_22);
6397  __Pyx_INCREF(__pyx_t_19);
6398  __Pyx_INCREF(function);
6399  __Pyx_DECREF_SET(__pyx_t_22, function);
6400  __pyx_t_23 = 1;
6401  }
6402  }
6403  __pyx_t_24 = PyTuple_New(2+__pyx_t_23); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6404  __Pyx_GOTREF(__pyx_t_24);
6405  if (__pyx_t_19) {
6406  __Pyx_GIVEREF(__pyx_t_19); PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_19); __pyx_t_19 = NULL;
6407  }
6408  __Pyx_GIVEREF(__pyx_t_18);
6409  PyTuple_SET_ITEM(__pyx_t_24, 0+__pyx_t_23, __pyx_t_18);
6410  __Pyx_GIVEREF(__pyx_t_21);
6411  PyTuple_SET_ITEM(__pyx_t_24, 1+__pyx_t_23, __pyx_t_21);
6412  __pyx_t_18 = 0;
6413  __pyx_t_21 = 0;
6414  __pyx_t_20 = __Pyx_PyObject_Call(__pyx_t_22, __pyx_t_24, NULL); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6415  __Pyx_GOTREF(__pyx_t_20);
6416  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
6417  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
6418  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6419  __Pyx_GOTREF(__pyx_t_22);
6420  __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6421  __Pyx_GOTREF(__pyx_t_24);
6422  __pyx_t_21 = PyTuple_New(2); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6423  __Pyx_GOTREF(__pyx_t_21);
6424  __Pyx_GIVEREF(__pyx_t_22);
6425  PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_22);
6426  __Pyx_GIVEREF(__pyx_t_24);
6427  PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_24);
6428  __pyx_t_22 = 0;
6429  __pyx_t_24 = 0;
6430  __pyx_t_24 = PyObject_GetItem(__pyx_t_20, __pyx_t_21); if (unlikely(__pyx_t_24 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
6431  __Pyx_GOTREF(__pyx_t_24);
6432  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
6433  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
6434  __pyx_t_21 = PyNumber_Add(__pyx_t_17, __pyx_t_24); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6435  __Pyx_GOTREF(__pyx_t_21);
6436  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6437  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
6438  __pyx_t_24 = __Pyx_PyFloat_AddObjC(__pyx_t_21, __pyx_float_1_0eneg_20, 1.0e-20, 0); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6439  __Pyx_GOTREF(__pyx_t_24);
6440  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
6441  __pyx_t_25 = __pyx_PyFloat_AsDouble(__pyx_t_24); if (unlikely((__pyx_t_25 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6442  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
6443  __pyx_v_denom = __pyx_t_25;
6444 
6445  /* "subsurfaceTransportFunctions.pyx":246
6446  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J]
6447  * denom = material_functions[material_left](x[eN,ebN_local,k],t)[I,J] + material_functions[material_right](x[eN,ebN_local,k],t)[I,J] + 1.0e-20
6448  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom # <<<<<<<<<<<<<<
6449  *
6450  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t,
6451  */
6452  if (unlikely(__pyx_v_denom == 0)) {
6453  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
6454  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6455  }
6456  __pyx_t_26 = __pyx_v_eN;
6457  __pyx_t_27 = __pyx_v_ebN_local;
6458  __pyx_t_28 = __pyx_v_k;
6459  __pyx_t_29 = ((__pyx_v_I * __pyx_v_nd) + __pyx_v_J);
6460  __pyx_t_30 = -1;
6461  if (__pyx_t_26 < 0) {
6462  __pyx_t_26 += __pyx_pybuffernd_ebq_vals.diminfo[0].shape;
6463  if (unlikely(__pyx_t_26 < 0)) __pyx_t_30 = 0;
6464  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_ebq_vals.diminfo[0].shape)) __pyx_t_30 = 0;
6465  if (__pyx_t_27 < 0) {
6466  __pyx_t_27 += __pyx_pybuffernd_ebq_vals.diminfo[1].shape;
6467  if (unlikely(__pyx_t_27 < 0)) __pyx_t_30 = 1;
6468  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_ebq_vals.diminfo[1].shape)) __pyx_t_30 = 1;
6469  if (__pyx_t_28 < 0) {
6470  __pyx_t_28 += __pyx_pybuffernd_ebq_vals.diminfo[2].shape;
6471  if (unlikely(__pyx_t_28 < 0)) __pyx_t_30 = 2;
6472  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_ebq_vals.diminfo[2].shape)) __pyx_t_30 = 2;
6473  if (__pyx_t_29 < 0) {
6474  __pyx_t_29 += __pyx_pybuffernd_ebq_vals.diminfo[3].shape;
6475  if (unlikely(__pyx_t_29 < 0)) __pyx_t_30 = 3;
6476  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_ebq_vals.diminfo[3].shape)) __pyx_t_30 = 3;
6477  if (unlikely(__pyx_t_30 != -1)) {
6478  __Pyx_RaiseBufferIndexError(__pyx_t_30);
6479  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6480  }
6481  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_ebq_vals.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_ebq_vals.diminfo[1].strides, __pyx_t_28, __pyx_pybuffernd_ebq_vals.diminfo[2].strides, __pyx_t_29, __pyx_pybuffernd_ebq_vals.diminfo[3].strides) = (__pyx_v_numer / __pyx_v_denom);
6482  }
6483  }
6484  }
6485  }
6486  }
6487 
6488  /* "subsurfaceTransportFunctions.pyx":219
6489  * material_functions[material_right](x[eN,ebN_local,k],t))
6490  *
6491  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
6492  * double t,
6493  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
6494  */
6495 
6496  /* function exit code */
6497  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6498  goto __pyx_L0;
6499  __pyx_L1_error:;
6500  __Pyx_XDECREF(__pyx_t_17);
6501  __Pyx_XDECREF(__pyx_t_18);
6502  __Pyx_XDECREF(__pyx_t_19);
6503  __Pyx_XDECREF(__pyx_t_20);
6504  __Pyx_XDECREF(__pyx_t_21);
6505  __Pyx_XDECREF(__pyx_t_22);
6506  __Pyx_XDECREF(__pyx_t_24);
6507  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
6508  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
6509  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
6510  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
6511  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
6512  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
6513  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
6514  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
6515  __pyx_r = NULL;
6516  goto __pyx_L2;
6517  __pyx_L0:;
6518  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
6519  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
6520  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
6521  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
6522  __pyx_L2:;
6523  __Pyx_XGIVEREF(__pyx_r);
6524  __Pyx_RefNannyFinishContext();
6525  return __pyx_r;
6526 }
6527 
6528 /* "subsurfaceTransportFunctions.pyx":248
6529  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
6530  *
6531  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
6532  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
6533  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
6534  */
6535 
6536 /* Python wrapper */
6537 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6538 static char __pyx_doc_28subsurfaceTransportFunctions_24evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage[] = "\n loop over quadrature array and evaluate function f(x,t) = 0.5(f^L_j(x,t)+f^R_k(x,t)) assuming element on left \n is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
6539 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage = {"evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_24evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage};
6540 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6541  double __pyx_v_t;
6542  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray = 0;
6543  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
6544  PyArrayObject *__pyx_v_x = 0;
6545  PyArrayObject *__pyx_v_ebq_global_vals = 0;
6546  PyObject *__pyx_v_material_functions = 0;
6547  int __pyx_lineno = 0;
6548  const char *__pyx_filename = NULL;
6549  int __pyx_clineno = 0;
6550  PyObject *__pyx_r = 0;
6551  __Pyx_RefNannyDeclarations
6552  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage (wrapper)", 0);
6553  {
6554  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_x,&__pyx_n_s_ebq_global_vals,&__pyx_n_s_material_functions,0};
6555  PyObject* values[6] = {0,0,0,0,0,0};
6556  if (unlikely(__pyx_kwds)) {
6557  Py_ssize_t kw_args;
6558  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6559  switch (pos_args) {
6560  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6561  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6562  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6563  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6564  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6565  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6566  case 0: break;
6567  default: goto __pyx_L5_argtuple_error;
6568  }
6569  kw_args = PyDict_Size(__pyx_kwds);
6570  switch (pos_args) {
6571  case 0:
6572  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
6573  else goto __pyx_L5_argtuple_error;
6574  case 1:
6575  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
6576  else {
6577  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
6578  }
6579  case 2:
6580  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
6581  else {
6582  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
6583  }
6584  case 3:
6585  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
6586  else {
6587  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
6588  }
6589  case 4:
6590  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ebq_global_vals)) != 0)) kw_args--;
6591  else {
6592  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
6593  }
6594  case 5:
6595  if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
6596  else {
6597  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
6598  }
6599  }
6600  if (unlikely(kw_args > 0)) {
6601  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
6602  }
6603  } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
6604  goto __pyx_L5_argtuple_error;
6605  } else {
6606  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6607  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6608  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6609  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6610  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6611  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6612  }
6613  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
6614  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[1]);
6615  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[2]);
6616  __pyx_v_x = ((PyArrayObject *)values[3]);
6617  __pyx_v_ebq_global_vals = ((PyArrayObject *)values[4]);
6618  __pyx_v_material_functions = ((PyObject*)values[5]);
6619  }
6620  goto __pyx_L4_argument_unpacking_done;
6621  __pyx_L5_argtuple_error:;
6622  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
6623  __pyx_L3_error:;
6624  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
6625  __Pyx_RefNannyFinishContext();
6626  return NULL;
6627  __pyx_L4_argument_unpacking_done:;
6628  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6629  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6630  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6631  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_global_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_global_vals", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6632  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6633  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_24evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(__pyx_self, __pyx_v_t, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_x, __pyx_v_ebq_global_vals, __pyx_v_material_functions);
6634 
6635  /* function exit code */
6636  goto __pyx_L0;
6637  __pyx_L1_error:;
6638  __pyx_r = NULL;
6639  __pyx_L0:;
6640  __Pyx_RefNannyFinishContext();
6641  return __pyx_r;
6642 }
6643 
6644 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_24evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions) {
6645  int __pyx_v_ebN;
6646  int __pyx_v_material_left;
6647  int __pyx_v_material_right;
6648  npy_intp __pyx_v_k;
6649  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_global_vals;
6650  __Pyx_Buffer __pyx_pybuffer_ebq_global_vals;
6651  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
6652  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
6653  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
6654  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
6655  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
6656  __Pyx_Buffer __pyx_pybuffer_x;
6657  PyObject *__pyx_r = NULL;
6658  __Pyx_RefNannyDeclarations
6659  npy_intp __pyx_t_1;
6660  int __pyx_t_2;
6661  Py_ssize_t __pyx_t_3;
6662  Py_ssize_t __pyx_t_4;
6663  int __pyx_t_5;
6664  Py_ssize_t __pyx_t_6;
6665  Py_ssize_t __pyx_t_7;
6666  npy_intp __pyx_t_8;
6667  npy_intp __pyx_t_9;
6668  PyObject *__pyx_t_10 = NULL;
6669  PyObject *__pyx_t_11 = NULL;
6670  PyObject *__pyx_t_12 = NULL;
6671  PyObject *__pyx_t_13 = NULL;
6672  PyObject *__pyx_t_14 = NULL;
6673  Py_ssize_t __pyx_t_15;
6674  PyObject *__pyx_t_16 = NULL;
6675  PyObject *__pyx_t_17 = NULL;
6676  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_18;
6677  Py_ssize_t __pyx_t_19;
6678  Py_ssize_t __pyx_t_20;
6679  int __pyx_lineno = 0;
6680  const char *__pyx_filename = NULL;
6681  int __pyx_clineno = 0;
6682  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 0);
6683  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
6684  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
6685  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
6686  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
6687  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
6688  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
6689  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
6690  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
6691  __pyx_pybuffer_x.pybuffer.buf = NULL;
6692  __pyx_pybuffer_x.refcount = 0;
6693  __pyx_pybuffernd_x.data = NULL;
6694  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
6695  __pyx_pybuffer_ebq_global_vals.pybuffer.buf = NULL;
6696  __pyx_pybuffer_ebq_global_vals.refcount = 0;
6697  __pyx_pybuffernd_ebq_global_vals.data = NULL;
6698  __pyx_pybuffernd_ebq_global_vals.rcbuffer = &__pyx_pybuffer_ebq_global_vals;
6699  {
6700  __Pyx_BufFmt_StackElem __pyx_stack[1];
6701  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6702  }
6703  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
6704  {
6705  __Pyx_BufFmt_StackElem __pyx_stack[1];
6706  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6707  }
6708  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
6709  {
6710  __Pyx_BufFmt_StackElem __pyx_stack[1];
6711  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6712  }
6713  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
6714  {
6715  __Pyx_BufFmt_StackElem __pyx_stack[1];
6716  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_global_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6717  }
6718  __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[1];
6719 
6720  /* "subsurfaceTransportFunctions.pyx":263
6721  * cdef int ebN,material_left,material_right
6722  *
6723  * for ebN in range(x.shape[0]): # <<<<<<<<<<<<<<
6724  * material_left = elementBoundaryTypes[ebN,0]
6725  * material_right= elementBoundaryTypes[ebN,1]
6726  */
6727  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
6728  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
6729  __pyx_v_ebN = __pyx_t_2;
6730 
6731  /* "subsurfaceTransportFunctions.pyx":264
6732  *
6733  * for ebN in range(x.shape[0]):
6734  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
6735  * material_right= elementBoundaryTypes[ebN,1]
6736  * for k in range(x.shape[1]):
6737  */
6738  __pyx_t_3 = __pyx_v_ebN;
6739  __pyx_t_4 = 0;
6740  __pyx_t_5 = -1;
6741  if (__pyx_t_3 < 0) {
6742  __pyx_t_3 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
6743  if (unlikely(__pyx_t_3 < 0)) __pyx_t_5 = 0;
6744  } else if (unlikely(__pyx_t_3 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_5 = 0;
6745  if (__pyx_t_4 < 0) {
6746  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
6747  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 1;
6748  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_5 = 1;
6749  if (unlikely(__pyx_t_5 != -1)) {
6750  __Pyx_RaiseBufferIndexError(__pyx_t_5);
6751  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6752  }
6753  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
6754 
6755  /* "subsurfaceTransportFunctions.pyx":265
6756  * for ebN in range(x.shape[0]):
6757  * material_left = elementBoundaryTypes[ebN,0]
6758  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
6759  * for k in range(x.shape[1]):
6760  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+
6761  */
6762  __pyx_t_6 = __pyx_v_ebN;
6763  __pyx_t_7 = 1;
6764  __pyx_t_5 = -1;
6765  if (__pyx_t_6 < 0) {
6766  __pyx_t_6 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
6767  if (unlikely(__pyx_t_6 < 0)) __pyx_t_5 = 0;
6768  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_5 = 0;
6769  if (__pyx_t_7 < 0) {
6770  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
6771  if (unlikely(__pyx_t_7 < 0)) __pyx_t_5 = 1;
6772  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_5 = 1;
6773  if (unlikely(__pyx_t_5 != -1)) {
6774  __Pyx_RaiseBufferIndexError(__pyx_t_5);
6775  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6776  }
6777  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
6778 
6779  /* "subsurfaceTransportFunctions.pyx":266
6780  * material_left = elementBoundaryTypes[ebN,0]
6781  * material_right= elementBoundaryTypes[ebN,1]
6782  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
6783  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+
6784  * material_functions[material_right](x[ebN,k],t))
6785  */
6786  __pyx_t_8 = (__pyx_v_x->dimensions[1]);
6787  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
6788  __pyx_v_k = __pyx_t_9;
6789 
6790  /* "subsurfaceTransportFunctions.pyx":267
6791  * material_right= elementBoundaryTypes[ebN,1]
6792  * for k in range(x.shape[1]):
6793  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+ # <<<<<<<<<<<<<<
6794  * material_functions[material_right](x[ebN,k],t))
6795  *
6796  */
6797  if (unlikely(__pyx_v_material_functions == Py_None)) {
6798  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6799  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6800  }
6801  __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6802  __Pyx_GOTREF(__pyx_t_11);
6803  __pyx_t_12 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_11); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
6804  __Pyx_GOTREF(__pyx_t_12);
6805  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
6806  __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6807  __Pyx_GOTREF(__pyx_t_11);
6808  __pyx_t_13 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_k); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6809  __Pyx_GOTREF(__pyx_t_13);
6810  __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6811  __Pyx_GOTREF(__pyx_t_14);
6812  __Pyx_GIVEREF(__pyx_t_11);
6813  PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_11);
6814  __Pyx_GIVEREF(__pyx_t_13);
6815  PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_13);
6816  __pyx_t_11 = 0;
6817  __pyx_t_13 = 0;
6818  __pyx_t_13 = PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_14); if (unlikely(__pyx_t_13 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
6819  __Pyx_GOTREF(__pyx_t_13);
6820  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
6821  __pyx_t_14 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6822  __Pyx_GOTREF(__pyx_t_14);
6823  __pyx_t_11 = NULL;
6824  __pyx_t_15 = 0;
6825  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_12))) {
6826  __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12);
6827  if (likely(__pyx_t_11)) {
6828  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
6829  __Pyx_INCREF(__pyx_t_11);
6830  __Pyx_INCREF(function);
6831  __Pyx_DECREF_SET(__pyx_t_12, function);
6832  __pyx_t_15 = 1;
6833  }
6834  }
6835  __pyx_t_16 = PyTuple_New(2+__pyx_t_15); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6836  __Pyx_GOTREF(__pyx_t_16);
6837  if (__pyx_t_11) {
6838  __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_11); __pyx_t_11 = NULL;
6839  }
6840  __Pyx_GIVEREF(__pyx_t_13);
6841  PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_15, __pyx_t_13);
6842  __Pyx_GIVEREF(__pyx_t_14);
6843  PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_15, __pyx_t_14);
6844  __pyx_t_13 = 0;
6845  __pyx_t_14 = 0;
6846  __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_16, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6847  __Pyx_GOTREF(__pyx_t_10);
6848  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6849  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
6850 
6851  /* "subsurfaceTransportFunctions.pyx":268
6852  * for k in range(x.shape[1]):
6853  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+
6854  * material_functions[material_right](x[ebN,k],t)) # <<<<<<<<<<<<<<
6855  *
6856  *
6857  */
6858  if (unlikely(__pyx_v_material_functions == Py_None)) {
6859  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6860  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6861  }
6862  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6863  __Pyx_GOTREF(__pyx_t_16);
6864  __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_16); if (unlikely(__pyx_t_14 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
6865  __Pyx_GOTREF(__pyx_t_14);
6866  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6867  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6868  __Pyx_GOTREF(__pyx_t_16);
6869  __pyx_t_13 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_k); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6870  __Pyx_GOTREF(__pyx_t_13);
6871  __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6872  __Pyx_GOTREF(__pyx_t_11);
6873  __Pyx_GIVEREF(__pyx_t_16);
6874  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_16);
6875  __Pyx_GIVEREF(__pyx_t_13);
6876  PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_13);
6877  __pyx_t_16 = 0;
6878  __pyx_t_13 = 0;
6879  __pyx_t_13 = PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_11); if (unlikely(__pyx_t_13 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
6880  __Pyx_GOTREF(__pyx_t_13);
6881  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
6882  __pyx_t_11 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6883  __Pyx_GOTREF(__pyx_t_11);
6884  __pyx_t_16 = NULL;
6885  __pyx_t_15 = 0;
6886  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_14))) {
6887  __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_14);
6888  if (likely(__pyx_t_16)) {
6889  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
6890  __Pyx_INCREF(__pyx_t_16);
6891  __Pyx_INCREF(function);
6892  __Pyx_DECREF_SET(__pyx_t_14, function);
6893  __pyx_t_15 = 1;
6894  }
6895  }
6896  __pyx_t_17 = PyTuple_New(2+__pyx_t_15); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6897  __Pyx_GOTREF(__pyx_t_17);
6898  if (__pyx_t_16) {
6899  __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_16); __pyx_t_16 = NULL;
6900  }
6901  __Pyx_GIVEREF(__pyx_t_13);
6902  PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_15, __pyx_t_13);
6903  __Pyx_GIVEREF(__pyx_t_11);
6904  PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_15, __pyx_t_11);
6905  __pyx_t_13 = 0;
6906  __pyx_t_11 = 0;
6907  __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_17, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6908  __Pyx_GOTREF(__pyx_t_12);
6909  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6910  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
6911 
6912  /* "subsurfaceTransportFunctions.pyx":267
6913  * material_right= elementBoundaryTypes[ebN,1]
6914  * for k in range(x.shape[1]):
6915  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+ # <<<<<<<<<<<<<<
6916  * material_functions[material_right](x[ebN,k],t))
6917  *
6918  */
6919  __pyx_t_14 = PyNumber_Add(__pyx_t_10, __pyx_t_12); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6920  __Pyx_GOTREF(__pyx_t_14);
6921  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6922  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
6923  __pyx_t_12 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_14); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6924  __Pyx_GOTREF(__pyx_t_12);
6925  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
6926  __pyx_t_18 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_18 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6927  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
6928  __pyx_t_19 = __pyx_v_ebN;
6929  __pyx_t_20 = __pyx_v_k;
6930  __pyx_t_5 = -1;
6931  if (__pyx_t_19 < 0) {
6932  __pyx_t_19 += __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape;
6933  if (unlikely(__pyx_t_19 < 0)) __pyx_t_5 = 0;
6934  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape)) __pyx_t_5 = 0;
6935  if (__pyx_t_20 < 0) {
6936  __pyx_t_20 += __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape;
6937  if (unlikely(__pyx_t_20 < 0)) __pyx_t_5 = 1;
6938  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape)) __pyx_t_5 = 1;
6939  if (unlikely(__pyx_t_5 != -1)) {
6940  __Pyx_RaiseBufferIndexError(__pyx_t_5);
6941  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6942  }
6943  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides) = __pyx_t_18;
6944  }
6945  }
6946 
6947  /* "subsurfaceTransportFunctions.pyx":248
6948  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
6949  *
6950  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
6951  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
6952  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
6953  */
6954 
6955  /* function exit code */
6956  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6957  goto __pyx_L0;
6958  __pyx_L1_error:;
6959  __Pyx_XDECREF(__pyx_t_10);
6960  __Pyx_XDECREF(__pyx_t_11);
6961  __Pyx_XDECREF(__pyx_t_12);
6962  __Pyx_XDECREF(__pyx_t_13);
6963  __Pyx_XDECREF(__pyx_t_14);
6964  __Pyx_XDECREF(__pyx_t_16);
6965  __Pyx_XDECREF(__pyx_t_17);
6966  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
6967  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
6968  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
6969  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
6970  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
6971  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
6972  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
6973  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
6974  __pyx_r = NULL;
6975  goto __pyx_L2;
6976  __pyx_L0:;
6977  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
6978  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
6979  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
6980  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
6981  __pyx_L2:;
6982  __Pyx_XGIVEREF(__pyx_r);
6983  __Pyx_RefNannyFinishContext();
6984  return __pyx_r;
6985 }
6986 
6987 /* "subsurfaceTransportFunctions.pyx":271
6988  *
6989  *
6990  * def evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
6991  * double t,
6992  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
6993  */
6994 
6995 /* Python wrapper */
6996 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6997 static char __pyx_doc_28subsurfaceTransportFunctions_26evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage[] = "\n loop over quadrature array and evaluate function \ten f_{mn}(x,t) = f^L_{j,mn}(x,t)f^R_{k,mn}(x,t)/(f^L_{j,mn}(x,t)+f^R_{k,mn})\n assuming element on left is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
6998 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage = {"evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_26evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage};
6999 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7000  int __pyx_v_nd;
7001  double __pyx_v_t;
7002  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray = 0;
7003  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
7004  PyArrayObject *__pyx_v_x = 0;
7005  PyArrayObject *__pyx_v_ebq_global_vals = 0;
7006  PyObject *__pyx_v_material_functions = 0;
7007  int __pyx_lineno = 0;
7008  const char *__pyx_filename = NULL;
7009  int __pyx_clineno = 0;
7010  PyObject *__pyx_r = 0;
7011  __Pyx_RefNannyDeclarations
7012  __Pyx_RefNannySetupContext("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage (wrapper)", 0);
7013  {
7014  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nd,&__pyx_n_s_t,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_x,&__pyx_n_s_ebq_global_vals,&__pyx_n_s_material_functions,0};
7015  PyObject* values[7] = {0,0,0,0,0,0,0};
7016  if (unlikely(__pyx_kwds)) {
7017  Py_ssize_t kw_args;
7018  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7019  switch (pos_args) {
7020  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
7021  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
7022  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7023  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7024  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7025  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7026  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7027  case 0: break;
7028  default: goto __pyx_L5_argtuple_error;
7029  }
7030  kw_args = PyDict_Size(__pyx_kwds);
7031  switch (pos_args) {
7032  case 0:
7033  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
7034  else goto __pyx_L5_argtuple_error;
7035  case 1:
7036  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
7037  else {
7038  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7039  }
7040  case 2:
7041  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
7042  else {
7043  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7044  }
7045  case 3:
7046  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
7047  else {
7048  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7049  }
7050  case 4:
7051  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
7052  else {
7053  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7054  }
7055  case 5:
7056  if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ebq_global_vals)) != 0)) kw_args--;
7057  else {
7058  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7059  }
7060  case 6:
7061  if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
7062  else {
7063  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7064  }
7065  }
7066  if (unlikely(kw_args > 0)) {
7067  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7068  }
7069  } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
7070  goto __pyx_L5_argtuple_error;
7071  } else {
7072  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7073  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7074  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7075  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7076  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7077  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
7078  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
7079  }
7080  __pyx_v_nd = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7081  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7082  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[2]);
7083  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[3]);
7084  __pyx_v_x = ((PyArrayObject *)values[4]);
7085  __pyx_v_ebq_global_vals = ((PyArrayObject *)values[5]);
7086  __pyx_v_material_functions = ((PyObject*)values[6]);
7087  }
7088  goto __pyx_L4_argument_unpacking_done;
7089  __pyx_L5_argtuple_error:;
7090  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7091  __pyx_L3_error:;
7092  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
7093  __Pyx_RefNannyFinishContext();
7094  return NULL;
7095  __pyx_L4_argument_unpacking_done:;
7096  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7097  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7098  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7099  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_global_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_global_vals", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7100  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7101  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_26evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(__pyx_self, __pyx_v_nd, __pyx_v_t, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_x, __pyx_v_ebq_global_vals, __pyx_v_material_functions);
7102 
7103  /* function exit code */
7104  goto __pyx_L0;
7105  __pyx_L1_error:;
7106  __pyx_r = NULL;
7107  __pyx_L0:;
7108  __Pyx_RefNannyFinishContext();
7109  return __pyx_r;
7110 }
7111 
7112 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_26evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, double __pyx_v_t, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions) {
7113  int __pyx_v_ebN;
7114  int __pyx_v_k;
7115  int __pyx_v_material_left;
7116  int __pyx_v_material_right;
7117  int __pyx_v_I;
7118  int __pyx_v_J;
7119  double __pyx_v_numer;
7120  double __pyx_v_denom;
7121  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_global_vals;
7122  __Pyx_Buffer __pyx_pybuffer_ebq_global_vals;
7123  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
7124  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
7125  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
7126  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
7127  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
7128  __Pyx_Buffer __pyx_pybuffer_x;
7129  PyObject *__pyx_r = NULL;
7130  __Pyx_RefNannyDeclarations
7131  npy_intp __pyx_t_1;
7132  int __pyx_t_2;
7133  Py_ssize_t __pyx_t_3;
7134  Py_ssize_t __pyx_t_4;
7135  int __pyx_t_5;
7136  Py_ssize_t __pyx_t_6;
7137  Py_ssize_t __pyx_t_7;
7138  npy_intp __pyx_t_8;
7139  int __pyx_t_9;
7140  int __pyx_t_10;
7141  int __pyx_t_11;
7142  int __pyx_t_12;
7143  PyObject *__pyx_t_13 = NULL;
7144  PyObject *__pyx_t_14 = NULL;
7145  PyObject *__pyx_t_15 = NULL;
7146  PyObject *__pyx_t_16 = NULL;
7147  PyObject *__pyx_t_17 = NULL;
7148  Py_ssize_t __pyx_t_18;
7149  PyObject *__pyx_t_19 = NULL;
7150  PyObject *__pyx_t_20 = NULL;
7151  double __pyx_t_21;
7152  Py_ssize_t __pyx_t_22;
7153  Py_ssize_t __pyx_t_23;
7154  Py_ssize_t __pyx_t_24;
7155  int __pyx_t_25;
7156  int __pyx_lineno = 0;
7157  const char *__pyx_filename = NULL;
7158  int __pyx_clineno = 0;
7159  __Pyx_RefNannySetupContext("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 0);
7160  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
7161  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
7162  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
7163  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
7164  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
7165  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
7166  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
7167  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
7168  __pyx_pybuffer_x.pybuffer.buf = NULL;
7169  __pyx_pybuffer_x.refcount = 0;
7170  __pyx_pybuffernd_x.data = NULL;
7171  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
7172  __pyx_pybuffer_ebq_global_vals.pybuffer.buf = NULL;
7173  __pyx_pybuffer_ebq_global_vals.refcount = 0;
7174  __pyx_pybuffernd_ebq_global_vals.data = NULL;
7175  __pyx_pybuffernd_ebq_global_vals.rcbuffer = &__pyx_pybuffer_ebq_global_vals;
7176  {
7177  __Pyx_BufFmt_StackElem __pyx_stack[1];
7178  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7179  }
7180  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
7181  {
7182  __Pyx_BufFmt_StackElem __pyx_stack[1];
7183  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7184  }
7185  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
7186  {
7187  __Pyx_BufFmt_StackElem __pyx_stack[1];
7188  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7189  }
7190  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
7191  {
7192  __Pyx_BufFmt_StackElem __pyx_stack[1];
7193  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_global_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7194  }
7195  __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[2];
7196 
7197  /* "subsurfaceTransportFunctions.pyx":288
7198  * cdef double numer,denom
7199  *
7200  * for ebN in range(x.shape[0]): # <<<<<<<<<<<<<<
7201  * material_left = elementBoundaryTypes[ebN,0]
7202  * material_right= elementBoundaryTypes[ebN,1]
7203  */
7204  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
7205  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
7206  __pyx_v_ebN = __pyx_t_2;
7207 
7208  /* "subsurfaceTransportFunctions.pyx":289
7209  *
7210  * for ebN in range(x.shape[0]):
7211  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
7212  * material_right= elementBoundaryTypes[ebN,1]
7213  * for k in range(x.shape[1]):
7214  */
7215  __pyx_t_3 = __pyx_v_ebN;
7216  __pyx_t_4 = 0;
7217  __pyx_t_5 = -1;
7218  if (__pyx_t_3 < 0) {
7219  __pyx_t_3 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
7220  if (unlikely(__pyx_t_3 < 0)) __pyx_t_5 = 0;
7221  } else if (unlikely(__pyx_t_3 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_5 = 0;
7222  if (__pyx_t_4 < 0) {
7223  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
7224  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 1;
7225  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_5 = 1;
7226  if (unlikely(__pyx_t_5 != -1)) {
7227  __Pyx_RaiseBufferIndexError(__pyx_t_5);
7228  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7229  }
7230  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
7231 
7232  /* "subsurfaceTransportFunctions.pyx":290
7233  * for ebN in range(x.shape[0]):
7234  * material_left = elementBoundaryTypes[ebN,0]
7235  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
7236  * for k in range(x.shape[1]):
7237  * for I in range(nd):
7238  */
7239  __pyx_t_6 = __pyx_v_ebN;
7240  __pyx_t_7 = 1;
7241  __pyx_t_5 = -1;
7242  if (__pyx_t_6 < 0) {
7243  __pyx_t_6 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
7244  if (unlikely(__pyx_t_6 < 0)) __pyx_t_5 = 0;
7245  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_5 = 0;
7246  if (__pyx_t_7 < 0) {
7247  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
7248  if (unlikely(__pyx_t_7 < 0)) __pyx_t_5 = 1;
7249  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_5 = 1;
7250  if (unlikely(__pyx_t_5 != -1)) {
7251  __Pyx_RaiseBufferIndexError(__pyx_t_5);
7252  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7253  }
7254  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
7255 
7256  /* "subsurfaceTransportFunctions.pyx":291
7257  * material_left = elementBoundaryTypes[ebN,0]
7258  * material_right= elementBoundaryTypes[ebN,1]
7259  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
7260  * for I in range(nd):
7261  * for J in range(nd):
7262  */
7263  __pyx_t_8 = (__pyx_v_x->dimensions[1]);
7264  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_8; __pyx_t_5+=1) {
7265  __pyx_v_k = __pyx_t_5;
7266 
7267  /* "subsurfaceTransportFunctions.pyx":292
7268  * material_right= elementBoundaryTypes[ebN,1]
7269  * for k in range(x.shape[1]):
7270  * for I in range(nd): # <<<<<<<<<<<<<<
7271  * for J in range(nd):
7272  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J]
7273  */
7274  __pyx_t_9 = __pyx_v_nd;
7275  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
7276  __pyx_v_I = __pyx_t_10;
7277 
7278  /* "subsurfaceTransportFunctions.pyx":293
7279  * for k in range(x.shape[1]):
7280  * for I in range(nd):
7281  * for J in range(nd): # <<<<<<<<<<<<<<
7282  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J]
7283  * denom = material_functions[material_left](x[ebN,k],t)[I,J] + material_functions[material_right](x[ebN,k],t)[I,J] + 1.0e-20
7284  */
7285  __pyx_t_11 = __pyx_v_nd;
7286  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
7287  __pyx_v_J = __pyx_t_12;
7288 
7289  /* "subsurfaceTransportFunctions.pyx":294
7290  * for I in range(nd):
7291  * for J in range(nd):
7292  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J] # <<<<<<<<<<<<<<
7293  * denom = material_functions[material_left](x[ebN,k],t)[I,J] + material_functions[material_right](x[ebN,k],t)[I,J] + 1.0e-20
7294  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom
7295  */
7296  if (unlikely(__pyx_v_material_functions == Py_None)) {
7297  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7298  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7299  }
7300  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7301  __Pyx_GOTREF(__pyx_t_14);
7302  __pyx_t_15 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_14); if (unlikely(__pyx_t_15 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
7303  __Pyx_GOTREF(__pyx_t_15);
7304  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7305  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7306  __Pyx_GOTREF(__pyx_t_14);
7307  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7308  __Pyx_GOTREF(__pyx_t_16);
7309  __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7310  __Pyx_GOTREF(__pyx_t_17);
7311  __Pyx_GIVEREF(__pyx_t_14);
7312  PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_14);
7313  __Pyx_GIVEREF(__pyx_t_16);
7314  PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_16);
7315  __pyx_t_14 = 0;
7316  __pyx_t_16 = 0;
7317  __pyx_t_16 = PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_17); if (unlikely(__pyx_t_16 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
7318  __Pyx_GOTREF(__pyx_t_16);
7319  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
7320  __pyx_t_17 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7321  __Pyx_GOTREF(__pyx_t_17);
7322  __pyx_t_14 = NULL;
7323  __pyx_t_18 = 0;
7324  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_15))) {
7325  __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_15);
7326  if (likely(__pyx_t_14)) {
7327  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
7328  __Pyx_INCREF(__pyx_t_14);
7329  __Pyx_INCREF(function);
7330  __Pyx_DECREF_SET(__pyx_t_15, function);
7331  __pyx_t_18 = 1;
7332  }
7333  }
7334  __pyx_t_19 = PyTuple_New(2+__pyx_t_18); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7335  __Pyx_GOTREF(__pyx_t_19);
7336  if (__pyx_t_14) {
7337  __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_14); __pyx_t_14 = NULL;
7338  }
7339  __Pyx_GIVEREF(__pyx_t_16);
7340  PyTuple_SET_ITEM(__pyx_t_19, 0+__pyx_t_18, __pyx_t_16);
7341  __Pyx_GIVEREF(__pyx_t_17);
7342  PyTuple_SET_ITEM(__pyx_t_19, 1+__pyx_t_18, __pyx_t_17);
7343  __pyx_t_16 = 0;
7344  __pyx_t_17 = 0;
7345  __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_19, NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7346  __Pyx_GOTREF(__pyx_t_13);
7347  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
7348  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7349  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7350  __Pyx_GOTREF(__pyx_t_15);
7351  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7352  __Pyx_GOTREF(__pyx_t_19);
7353  __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7354  __Pyx_GOTREF(__pyx_t_17);
7355  __Pyx_GIVEREF(__pyx_t_15);
7356  PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_15);
7357  __Pyx_GIVEREF(__pyx_t_19);
7358  PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_19);
7359  __pyx_t_15 = 0;
7360  __pyx_t_19 = 0;
7361  __pyx_t_19 = PyObject_GetItem(__pyx_t_13, __pyx_t_17); if (unlikely(__pyx_t_19 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
7362  __Pyx_GOTREF(__pyx_t_19);
7363  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7364  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
7365  __pyx_t_17 = PyNumber_Multiply(__pyx_float_2_0, __pyx_t_19); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7366  __Pyx_GOTREF(__pyx_t_17);
7367  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
7368  if (unlikely(__pyx_v_material_functions == Py_None)) {
7369  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7370  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7371  }
7372  __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7373  __Pyx_GOTREF(__pyx_t_13);
7374  __pyx_t_15 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_13); if (unlikely(__pyx_t_15 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
7375  __Pyx_GOTREF(__pyx_t_15);
7376  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7377  __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7378  __Pyx_GOTREF(__pyx_t_13);
7379  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7380  __Pyx_GOTREF(__pyx_t_16);
7381  __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7382  __Pyx_GOTREF(__pyx_t_14);
7383  __Pyx_GIVEREF(__pyx_t_13);
7384  PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13);
7385  __Pyx_GIVEREF(__pyx_t_16);
7386  PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_16);
7387  __pyx_t_13 = 0;
7388  __pyx_t_16 = 0;
7389  __pyx_t_16 = PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_14); if (unlikely(__pyx_t_16 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
7390  __Pyx_GOTREF(__pyx_t_16);
7391  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7392  __pyx_t_14 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7393  __Pyx_GOTREF(__pyx_t_14);
7394  __pyx_t_13 = NULL;
7395  __pyx_t_18 = 0;
7396  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_15))) {
7397  __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_15);
7398  if (likely(__pyx_t_13)) {
7399  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
7400  __Pyx_INCREF(__pyx_t_13);
7401  __Pyx_INCREF(function);
7402  __Pyx_DECREF_SET(__pyx_t_15, function);
7403  __pyx_t_18 = 1;
7404  }
7405  }
7406  __pyx_t_20 = PyTuple_New(2+__pyx_t_18); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7407  __Pyx_GOTREF(__pyx_t_20);
7408  if (__pyx_t_13) {
7409  __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_13); __pyx_t_13 = NULL;
7410  }
7411  __Pyx_GIVEREF(__pyx_t_16);
7412  PyTuple_SET_ITEM(__pyx_t_20, 0+__pyx_t_18, __pyx_t_16);
7413  __Pyx_GIVEREF(__pyx_t_14);
7414  PyTuple_SET_ITEM(__pyx_t_20, 1+__pyx_t_18, __pyx_t_14);
7415  __pyx_t_16 = 0;
7416  __pyx_t_14 = 0;
7417  __pyx_t_19 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_20, NULL); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7418  __Pyx_GOTREF(__pyx_t_19);
7419  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
7420  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7421  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7422  __Pyx_GOTREF(__pyx_t_15);
7423  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7424  __Pyx_GOTREF(__pyx_t_20);
7425  __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7426  __Pyx_GOTREF(__pyx_t_14);
7427  __Pyx_GIVEREF(__pyx_t_15);
7428  PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_15);
7429  __Pyx_GIVEREF(__pyx_t_20);
7430  PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_20);
7431  __pyx_t_15 = 0;
7432  __pyx_t_20 = 0;
7433  __pyx_t_20 = PyObject_GetItem(__pyx_t_19, __pyx_t_14); if (unlikely(__pyx_t_20 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
7434  __Pyx_GOTREF(__pyx_t_20);
7435  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
7436  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7437  __pyx_t_14 = PyNumber_Multiply(__pyx_t_17, __pyx_t_20); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7438  __Pyx_GOTREF(__pyx_t_14);
7439  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
7440  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
7441  __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_t_14); if (unlikely((__pyx_t_21 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7442  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7443  __pyx_v_numer = __pyx_t_21;
7444 
7445  /* "subsurfaceTransportFunctions.pyx":295
7446  * for J in range(nd):
7447  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J]
7448  * denom = material_functions[material_left](x[ebN,k],t)[I,J] + material_functions[material_right](x[ebN,k],t)[I,J] + 1.0e-20 # <<<<<<<<<<<<<<
7449  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom
7450  *
7451  */
7452  if (unlikely(__pyx_v_material_functions == Py_None)) {
7453  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7454  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7455  }
7456  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7457  __Pyx_GOTREF(__pyx_t_20);
7458  __pyx_t_17 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_20); if (unlikely(__pyx_t_17 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
7459  __Pyx_GOTREF(__pyx_t_17);
7460  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
7461  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7462  __Pyx_GOTREF(__pyx_t_20);
7463  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7464  __Pyx_GOTREF(__pyx_t_19);
7465  __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7466  __Pyx_GOTREF(__pyx_t_15);
7467  __Pyx_GIVEREF(__pyx_t_20);
7468  PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_20);
7469  __Pyx_GIVEREF(__pyx_t_19);
7470  PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_19);
7471  __pyx_t_20 = 0;
7472  __pyx_t_19 = 0;
7473  __pyx_t_19 = PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_15); if (unlikely(__pyx_t_19 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
7474  __Pyx_GOTREF(__pyx_t_19);
7475  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7476  __pyx_t_15 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7477  __Pyx_GOTREF(__pyx_t_15);
7478  __pyx_t_20 = NULL;
7479  __pyx_t_18 = 0;
7480  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_17))) {
7481  __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_17);
7482  if (likely(__pyx_t_20)) {
7483  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
7484  __Pyx_INCREF(__pyx_t_20);
7485  __Pyx_INCREF(function);
7486  __Pyx_DECREF_SET(__pyx_t_17, function);
7487  __pyx_t_18 = 1;
7488  }
7489  }
7490  __pyx_t_16 = PyTuple_New(2+__pyx_t_18); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7491  __Pyx_GOTREF(__pyx_t_16);
7492  if (__pyx_t_20) {
7493  __Pyx_GIVEREF(__pyx_t_20); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_20); __pyx_t_20 = NULL;
7494  }
7495  __Pyx_GIVEREF(__pyx_t_19);
7496  PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_18, __pyx_t_19);
7497  __Pyx_GIVEREF(__pyx_t_15);
7498  PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_18, __pyx_t_15);
7499  __pyx_t_19 = 0;
7500  __pyx_t_15 = 0;
7501  __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_16, NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7502  __Pyx_GOTREF(__pyx_t_14);
7503  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7504  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
7505  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7506  __Pyx_GOTREF(__pyx_t_17);
7507  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7508  __Pyx_GOTREF(__pyx_t_16);
7509  __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7510  __Pyx_GOTREF(__pyx_t_15);
7511  __Pyx_GIVEREF(__pyx_t_17);
7512  PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_17);
7513  __Pyx_GIVEREF(__pyx_t_16);
7514  PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_16);
7515  __pyx_t_17 = 0;
7516  __pyx_t_16 = 0;
7517  __pyx_t_16 = PyObject_GetItem(__pyx_t_14, __pyx_t_15); if (unlikely(__pyx_t_16 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
7518  __Pyx_GOTREF(__pyx_t_16);
7519  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7520  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7521  if (unlikely(__pyx_v_material_functions == Py_None)) {
7522  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7523  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7524  }
7525  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7526  __Pyx_GOTREF(__pyx_t_14);
7527  __pyx_t_17 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_14); if (unlikely(__pyx_t_17 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
7528  __Pyx_GOTREF(__pyx_t_17);
7529  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7530  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7531  __Pyx_GOTREF(__pyx_t_14);
7532  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7533  __Pyx_GOTREF(__pyx_t_19);
7534  __pyx_t_20 = PyTuple_New(2); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7535  __Pyx_GOTREF(__pyx_t_20);
7536  __Pyx_GIVEREF(__pyx_t_14);
7537  PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_14);
7538  __Pyx_GIVEREF(__pyx_t_19);
7539  PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_t_19);
7540  __pyx_t_14 = 0;
7541  __pyx_t_19 = 0;
7542  __pyx_t_19 = PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_20); if (unlikely(__pyx_t_19 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
7543  __Pyx_GOTREF(__pyx_t_19);
7544  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
7545  __pyx_t_20 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7546  __Pyx_GOTREF(__pyx_t_20);
7547  __pyx_t_14 = NULL;
7548  __pyx_t_18 = 0;
7549  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_17))) {
7550  __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_17);
7551  if (likely(__pyx_t_14)) {
7552  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
7553  __Pyx_INCREF(__pyx_t_14);
7554  __Pyx_INCREF(function);
7555  __Pyx_DECREF_SET(__pyx_t_17, function);
7556  __pyx_t_18 = 1;
7557  }
7558  }
7559  __pyx_t_13 = PyTuple_New(2+__pyx_t_18); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7560  __Pyx_GOTREF(__pyx_t_13);
7561  if (__pyx_t_14) {
7562  __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_14); __pyx_t_14 = NULL;
7563  }
7564  __Pyx_GIVEREF(__pyx_t_19);
7565  PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_18, __pyx_t_19);
7566  __Pyx_GIVEREF(__pyx_t_20);
7567  PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_18, __pyx_t_20);
7568  __pyx_t_19 = 0;
7569  __pyx_t_20 = 0;
7570  __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_13, NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7571  __Pyx_GOTREF(__pyx_t_15);
7572  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7573  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
7574  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7575  __Pyx_GOTREF(__pyx_t_17);
7576  __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7577  __Pyx_GOTREF(__pyx_t_13);
7578  __pyx_t_20 = PyTuple_New(2); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7579  __Pyx_GOTREF(__pyx_t_20);
7580  __Pyx_GIVEREF(__pyx_t_17);
7581  PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_17);
7582  __Pyx_GIVEREF(__pyx_t_13);
7583  PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_t_13);
7584  __pyx_t_17 = 0;
7585  __pyx_t_13 = 0;
7586  __pyx_t_13 = PyObject_GetItem(__pyx_t_15, __pyx_t_20); if (unlikely(__pyx_t_13 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
7587  __Pyx_GOTREF(__pyx_t_13);
7588  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7589  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
7590  __pyx_t_20 = PyNumber_Add(__pyx_t_16, __pyx_t_13); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7591  __Pyx_GOTREF(__pyx_t_20);
7592  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7593  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7594  __pyx_t_13 = __Pyx_PyFloat_AddObjC(__pyx_t_20, __pyx_float_1_0eneg_20, 1.0e-20, 0); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7595  __Pyx_GOTREF(__pyx_t_13);
7596  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
7597  __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_t_13); if (unlikely((__pyx_t_21 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7598  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7599  __pyx_v_denom = __pyx_t_21;
7600 
7601  /* "subsurfaceTransportFunctions.pyx":296
7602  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J]
7603  * denom = material_functions[material_left](x[ebN,k],t)[I,J] + material_functions[material_right](x[ebN,k],t)[I,J] + 1.0e-20
7604  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom # <<<<<<<<<<<<<<
7605  *
7606  *
7607  */
7608  if (unlikely(__pyx_v_denom == 0)) {
7609  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
7610  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7611  }
7612  __pyx_t_22 = __pyx_v_ebN;
7613  __pyx_t_23 = __pyx_v_k;
7614  __pyx_t_24 = ((__pyx_v_I * __pyx_v_nd) + __pyx_v_J);
7615  __pyx_t_25 = -1;
7616  if (__pyx_t_22 < 0) {
7617  __pyx_t_22 += __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape;
7618  if (unlikely(__pyx_t_22 < 0)) __pyx_t_25 = 0;
7619  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape)) __pyx_t_25 = 0;
7620  if (__pyx_t_23 < 0) {
7621  __pyx_t_23 += __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape;
7622  if (unlikely(__pyx_t_23 < 0)) __pyx_t_25 = 1;
7623  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape)) __pyx_t_25 = 1;
7624  if (__pyx_t_24 < 0) {
7625  __pyx_t_24 += __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape;
7626  if (unlikely(__pyx_t_24 < 0)) __pyx_t_25 = 2;
7627  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape)) __pyx_t_25 = 2;
7628  if (unlikely(__pyx_t_25 != -1)) {
7629  __Pyx_RaiseBufferIndexError(__pyx_t_25);
7630  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7631  }
7632  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides, __pyx_t_24, __pyx_pybuffernd_ebq_global_vals.diminfo[2].strides) = (__pyx_v_numer / __pyx_v_denom);
7633  }
7634  }
7635  }
7636  }
7637 
7638  /* "subsurfaceTransportFunctions.pyx":271
7639  *
7640  *
7641  * def evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
7642  * double t,
7643  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
7644  */
7645 
7646  /* function exit code */
7647  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7648  goto __pyx_L0;
7649  __pyx_L1_error:;
7650  __Pyx_XDECREF(__pyx_t_13);
7651  __Pyx_XDECREF(__pyx_t_14);
7652  __Pyx_XDECREF(__pyx_t_15);
7653  __Pyx_XDECREF(__pyx_t_16);
7654  __Pyx_XDECREF(__pyx_t_17);
7655  __Pyx_XDECREF(__pyx_t_19);
7656  __Pyx_XDECREF(__pyx_t_20);
7657  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
7658  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
7659  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
7660  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
7661  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
7662  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
7663  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
7664  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
7665  __pyx_r = NULL;
7666  goto __pyx_L2;
7667  __pyx_L0:;
7668  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
7669  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
7670  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
7671  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
7672  __pyx_L2:;
7673  __Pyx_XGIVEREF(__pyx_r);
7674  __Pyx_RefNannyFinishContext();
7675  return __pyx_r;
7676 }
7677 
7678 /* "subsurfaceTransportFunctions.pyx":301
7679  *
7680  * ##################################################
7681  * def RE_NCP1_evaluateElementCoefficients_Linear(double rho, # <<<<<<<<<<<<<<
7682  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
7683  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
7684  */
7685 
7686 /* Python wrapper */
7687 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7688 static char __pyx_doc_28subsurfaceTransportFunctions_28RE_NCP1_evaluateElementCoefficients_Linear[] = "\n routine for evaluating linaer interface (nodal) coefficients in NCP1 approximation for Darcy Flow\n\n Approximation:\n uses nodal quadrature where the nodes are face barycenters\n uses harmonic average for intrinsic permeability/ hydraulic conductivity\n assumes slight compressiblity for now\n\n TODO:\n everything\n \n ";
7689 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear = {"RE_NCP1_evaluateElementCoefficients_Linear", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_28RE_NCP1_evaluateElementCoefficients_Linear};
7690 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7691  double __pyx_v_rho;
7692  PyArrayObject *__pyx_v_gravity = 0;
7693  PyArrayObject *__pyx_v_rowptr = 0;
7694  PyArrayObject *__pyx_v_colind = 0;
7695  PyArrayObject *__pyx_v_KWs = 0;
7696  int __pyx_v_nSpace;
7697  int __pyx_v_nElements_global;
7698  int __pyx_v_nElementBoundaries_element;
7699  PyArrayObject *__pyx_v_elementNeighborsArray = 0;
7700  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
7701  PyArrayObject *__pyx_v_q_flin = 0;
7702  PyArrayObject *__pyx_v_q_alin = 0;
7703  int __pyx_lineno = 0;
7704  const char *__pyx_filename = NULL;
7705  int __pyx_clineno = 0;
7706  PyObject *__pyx_r = 0;
7707  __Pyx_RefNannyDeclarations
7708  __Pyx_RefNannySetupContext("RE_NCP1_evaluateElementCoefficients_Linear (wrapper)", 0);
7709  {
7710  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rho,&__pyx_n_s_gravity,&__pyx_n_s_rowptr,&__pyx_n_s_colind,&__pyx_n_s_KWs,&__pyx_n_s_nSpace,&__pyx_n_s_nElements_global,&__pyx_n_s_nElementBoundaries_element,&__pyx_n_s_elementNeighborsArray,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_q_flin,&__pyx_n_s_q_alin,0};
7711  PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
7712  if (unlikely(__pyx_kwds)) {
7713  Py_ssize_t kw_args;
7714  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7715  switch (pos_args) {
7716  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
7717  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
7718  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
7719  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
7720  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
7721  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
7722  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
7723  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7724  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7725  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7726  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7727  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7728  case 0: break;
7729  default: goto __pyx_L5_argtuple_error;
7730  }
7731  kw_args = PyDict_Size(__pyx_kwds);
7732  switch (pos_args) {
7733  case 0:
7734  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rho)) != 0)) kw_args--;
7735  else goto __pyx_L5_argtuple_error;
7736  case 1:
7737  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_gravity)) != 0)) kw_args--;
7738  else {
7739  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7740  }
7741  case 2:
7742  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rowptr)) != 0)) kw_args--;
7743  else {
7744  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7745  }
7746  case 3:
7747  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_colind)) != 0)) kw_args--;
7748  else {
7749  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7750  }
7751  case 4:
7752  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_KWs)) != 0)) kw_args--;
7753  else {
7754  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7755  }
7756  case 5:
7757  if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nSpace)) != 0)) kw_args--;
7758  else {
7759  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7760  }
7761  case 6:
7762  if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nElements_global)) != 0)) kw_args--;
7763  else {
7764  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7765  }
7766  case 7:
7767  if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nElementBoundaries_element)) != 0)) kw_args--;
7768  else {
7769  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7770  }
7771  case 8:
7772  if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementNeighborsArray)) != 0)) kw_args--;
7773  else {
7774  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7775  }
7776  case 9:
7777  if (likely((values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
7778  else {
7779  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7780  }
7781  case 10:
7782  if (likely((values[10] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_flin)) != 0)) kw_args--;
7783  else {
7784  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 10); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7785  }
7786  case 11:
7787  if (likely((values[11] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_alin)) != 0)) kw_args--;
7788  else {
7789  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 11); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7790  }
7791  }
7792  if (unlikely(kw_args > 0)) {
7793  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RE_NCP1_evaluateElementCoefficients_Linear") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7794  }
7795  } else if (PyTuple_GET_SIZE(__pyx_args) != 12) {
7796  goto __pyx_L5_argtuple_error;
7797  } else {
7798  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7799  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7800  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7801  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7802  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7803  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
7804  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
7805  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
7806  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
7807  values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
7808  values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
7809  values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
7810  }
7811  __pyx_v_rho = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_rho == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7812  __pyx_v_gravity = ((PyArrayObject *)values[1]);
7813  __pyx_v_rowptr = ((PyArrayObject *)values[2]);
7814  __pyx_v_colind = ((PyArrayObject *)values[3]);
7815  __pyx_v_KWs = ((PyArrayObject *)values[4]);
7816  __pyx_v_nSpace = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nSpace == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7817  __pyx_v_nElements_global = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_nElements_global == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7818  __pyx_v_nElementBoundaries_element = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_nElementBoundaries_element == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7819  __pyx_v_elementNeighborsArray = ((PyArrayObject *)values[8]);
7820  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[9]);
7821  __pyx_v_q_flin = ((PyArrayObject *)values[10]);
7822  __pyx_v_q_alin = ((PyArrayObject *)values[11]);
7823  }
7824  goto __pyx_L4_argument_unpacking_done;
7825  __pyx_L5_argtuple_error:;
7826  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7827  __pyx_L3_error:;
7828  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_evaluateElementCoefficients_Linear", __pyx_clineno, __pyx_lineno, __pyx_filename);
7829  __Pyx_RefNannyFinishContext();
7830  return NULL;
7831  __pyx_L4_argument_unpacking_done:;
7832  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gravity), __pyx_ptype_5numpy_ndarray, 1, "gravity", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7833  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rowptr), __pyx_ptype_5numpy_ndarray, 1, "rowptr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7834  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_colind), __pyx_ptype_5numpy_ndarray, 1, "colind", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7835  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_KWs), __pyx_ptype_5numpy_ndarray, 1, "KWs", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7836  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementNeighborsArray), __pyx_ptype_5numpy_ndarray, 1, "elementNeighborsArray", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7837  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7838  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_flin), __pyx_ptype_5numpy_ndarray, 1, "q_flin", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7839  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_alin), __pyx_ptype_5numpy_ndarray, 1, "q_alin", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7840  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_28RE_NCP1_evaluateElementCoefficients_Linear(__pyx_self, __pyx_v_rho, __pyx_v_gravity, __pyx_v_rowptr, __pyx_v_colind, __pyx_v_KWs, __pyx_v_nSpace, __pyx_v_nElements_global, __pyx_v_nElementBoundaries_element, __pyx_v_elementNeighborsArray, __pyx_v_elementMaterialTypes, __pyx_v_q_flin, __pyx_v_q_alin);
7841 
7842  /* function exit code */
7843  goto __pyx_L0;
7844  __pyx_L1_error:;
7845  __pyx_r = NULL;
7846  __pyx_L0:;
7847  __Pyx_RefNannyFinishContext();
7848  return __pyx_r;
7849 }
7850 
7851 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_28RE_NCP1_evaluateElementCoefficients_Linear(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_rho, PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, PyArrayObject *__pyx_v_KWs, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, PyArrayObject *__pyx_v_elementNeighborsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin) {
7852  int __pyx_v_eN;
7853  int __pyx_v_eN_neighbor;
7854  int __pyx_v_ii;
7855  int __pyx_v_I;
7856  int __pyx_v_ebN;
7857  int __pyx_v_matID;
7858  int __pyx_v_matID_neig;
7859  CYTHON_UNUSED int __pyx_v_nSpace2;
7860  int __pyx_v_nnz;
7861  PyArrayObject *__pyx_v_a_eN = 0;
7862  PyArrayObject *__pyx_v_a_neig = 0;
7863  PyArrayObject *__pyx_v_a_avg = 0;
7864  __Pyx_LocalBuf_ND __pyx_pybuffernd_KWs;
7865  __Pyx_Buffer __pyx_pybuffer_KWs;
7866  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_avg;
7867  __Pyx_Buffer __pyx_pybuffer_a_avg;
7868  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_eN;
7869  __Pyx_Buffer __pyx_pybuffer_a_eN;
7870  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_neig;
7871  __Pyx_Buffer __pyx_pybuffer_a_neig;
7872  __Pyx_LocalBuf_ND __pyx_pybuffernd_colind;
7873  __Pyx_Buffer __pyx_pybuffer_colind;
7874  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
7875  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
7876  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementNeighborsArray;
7877  __Pyx_Buffer __pyx_pybuffer_elementNeighborsArray;
7878  __Pyx_LocalBuf_ND __pyx_pybuffernd_gravity;
7879  __Pyx_Buffer __pyx_pybuffer_gravity;
7880  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_alin;
7881  __Pyx_Buffer __pyx_pybuffer_q_alin;
7882  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_flin;
7883  __Pyx_Buffer __pyx_pybuffer_q_flin;
7884  __Pyx_LocalBuf_ND __pyx_pybuffernd_rowptr;
7885  __Pyx_Buffer __pyx_pybuffer_rowptr;
7886  PyObject *__pyx_r = NULL;
7887  __Pyx_RefNannyDeclarations
7888  Py_ssize_t __pyx_t_1;
7889  int __pyx_t_2;
7890  PyObject *__pyx_t_3 = NULL;
7891  PyObject *__pyx_t_4 = NULL;
7892  PyObject *__pyx_t_5 = NULL;
7893  PyObject *__pyx_t_6 = NULL;
7894  Py_ssize_t __pyx_t_7;
7895  PyObject *__pyx_t_8 = NULL;
7896  PyArrayObject *__pyx_t_9 = NULL;
7897  PyArrayObject *__pyx_t_10 = NULL;
7898  PyArrayObject *__pyx_t_11 = NULL;
7899  int __pyx_t_12;
7900  Py_ssize_t __pyx_t_13;
7901  int __pyx_t_14;
7902  int __pyx_t_15;
7903  Py_ssize_t __pyx_t_16;
7904  Py_ssize_t __pyx_t_17;
7905  int __pyx_t_18;
7906  Py_ssize_t __pyx_t_19;
7907  Py_ssize_t __pyx_t_20;
7908  Py_ssize_t __pyx_t_21;
7909  int __pyx_t_22;
7910  Py_ssize_t __pyx_t_23;
7911  int __pyx_t_24;
7912  Py_ssize_t __pyx_t_25;
7913  int __pyx_t_26;
7914  Py_ssize_t __pyx_t_27;
7915  Py_ssize_t __pyx_t_28;
7916  Py_ssize_t __pyx_t_29;
7917  Py_ssize_t __pyx_t_30;
7918  Py_ssize_t __pyx_t_31;
7919  Py_ssize_t __pyx_t_32;
7920  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_33;
7921  Py_ssize_t __pyx_t_34;
7922  Py_ssize_t __pyx_t_35;
7923  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_36;
7924  Py_ssize_t __pyx_t_37;
7925  Py_ssize_t __pyx_t_38;
7926  Py_ssize_t __pyx_t_39;
7927  Py_ssize_t __pyx_t_40;
7928  Py_ssize_t __pyx_t_41;
7929  Py_ssize_t __pyx_t_42;
7930  Py_ssize_t __pyx_t_43;
7931  Py_ssize_t __pyx_t_44;
7932  Py_ssize_t __pyx_t_45;
7933  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_46;
7934  Py_ssize_t __pyx_t_47;
7935  Py_ssize_t __pyx_t_48;
7936  int __pyx_t_49;
7937  Py_ssize_t __pyx_t_50;
7938  Py_ssize_t __pyx_t_51;
7939  Py_ssize_t __pyx_t_52;
7940  Py_ssize_t __pyx_t_53;
7941  Py_ssize_t __pyx_t_54;
7942  int __pyx_lineno = 0;
7943  const char *__pyx_filename = NULL;
7944  int __pyx_clineno = 0;
7945  __Pyx_RefNannySetupContext("RE_NCP1_evaluateElementCoefficients_Linear", 0);
7946  __pyx_pybuffer_a_eN.pybuffer.buf = NULL;
7947  __pyx_pybuffer_a_eN.refcount = 0;
7948  __pyx_pybuffernd_a_eN.data = NULL;
7949  __pyx_pybuffernd_a_eN.rcbuffer = &__pyx_pybuffer_a_eN;
7950  __pyx_pybuffer_a_neig.pybuffer.buf = NULL;
7951  __pyx_pybuffer_a_neig.refcount = 0;
7952  __pyx_pybuffernd_a_neig.data = NULL;
7953  __pyx_pybuffernd_a_neig.rcbuffer = &__pyx_pybuffer_a_neig;
7954  __pyx_pybuffer_a_avg.pybuffer.buf = NULL;
7955  __pyx_pybuffer_a_avg.refcount = 0;
7956  __pyx_pybuffernd_a_avg.data = NULL;
7957  __pyx_pybuffernd_a_avg.rcbuffer = &__pyx_pybuffer_a_avg;
7958  __pyx_pybuffer_gravity.pybuffer.buf = NULL;
7959  __pyx_pybuffer_gravity.refcount = 0;
7960  __pyx_pybuffernd_gravity.data = NULL;
7961  __pyx_pybuffernd_gravity.rcbuffer = &__pyx_pybuffer_gravity;
7962  __pyx_pybuffer_rowptr.pybuffer.buf = NULL;
7963  __pyx_pybuffer_rowptr.refcount = 0;
7964  __pyx_pybuffernd_rowptr.data = NULL;
7965  __pyx_pybuffernd_rowptr.rcbuffer = &__pyx_pybuffer_rowptr;
7966  __pyx_pybuffer_colind.pybuffer.buf = NULL;
7967  __pyx_pybuffer_colind.refcount = 0;
7968  __pyx_pybuffernd_colind.data = NULL;
7969  __pyx_pybuffernd_colind.rcbuffer = &__pyx_pybuffer_colind;
7970  __pyx_pybuffer_KWs.pybuffer.buf = NULL;
7971  __pyx_pybuffer_KWs.refcount = 0;
7972  __pyx_pybuffernd_KWs.data = NULL;
7973  __pyx_pybuffernd_KWs.rcbuffer = &__pyx_pybuffer_KWs;
7974  __pyx_pybuffer_elementNeighborsArray.pybuffer.buf = NULL;
7975  __pyx_pybuffer_elementNeighborsArray.refcount = 0;
7976  __pyx_pybuffernd_elementNeighborsArray.data = NULL;
7977  __pyx_pybuffernd_elementNeighborsArray.rcbuffer = &__pyx_pybuffer_elementNeighborsArray;
7978  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
7979  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
7980  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
7981  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
7982  __pyx_pybuffer_q_flin.pybuffer.buf = NULL;
7983  __pyx_pybuffer_q_flin.refcount = 0;
7984  __pyx_pybuffernd_q_flin.data = NULL;
7985  __pyx_pybuffernd_q_flin.rcbuffer = &__pyx_pybuffer_q_flin;
7986  __pyx_pybuffer_q_alin.pybuffer.buf = NULL;
7987  __pyx_pybuffer_q_alin.refcount = 0;
7988  __pyx_pybuffernd_q_alin.data = NULL;
7989  __pyx_pybuffernd_q_alin.rcbuffer = &__pyx_pybuffer_q_alin;
7990  {
7991  __Pyx_BufFmt_StackElem __pyx_stack[1];
7992  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer, (PyObject*)__pyx_v_gravity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7993  }
7994  __pyx_pybuffernd_gravity.diminfo[0].strides = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_gravity.diminfo[0].shape = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.shape[0];
7995  {
7996  __Pyx_BufFmt_StackElem __pyx_stack[1];
7997  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_rowptr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7998  }
7999  __pyx_pybuffernd_rowptr.diminfo[0].strides = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rowptr.diminfo[0].shape = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.shape[0];
8000  {
8001  __Pyx_BufFmt_StackElem __pyx_stack[1];
8002  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_colind.rcbuffer->pybuffer, (PyObject*)__pyx_v_colind, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8003  }
8004  __pyx_pybuffernd_colind.diminfo[0].strides = __pyx_pybuffernd_colind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_colind.diminfo[0].shape = __pyx_pybuffernd_colind.rcbuffer->pybuffer.shape[0];
8005  {
8006  __Pyx_BufFmt_StackElem __pyx_stack[1];
8007  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_KWs.rcbuffer->pybuffer, (PyObject*)__pyx_v_KWs, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8008  }
8009  __pyx_pybuffernd_KWs.diminfo[0].strides = __pyx_pybuffernd_KWs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_KWs.diminfo[0].shape = __pyx_pybuffernd_KWs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_KWs.diminfo[1].strides = __pyx_pybuffernd_KWs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_KWs.diminfo[1].shape = __pyx_pybuffernd_KWs.rcbuffer->pybuffer.shape[1];
8010  {
8011  __Pyx_BufFmt_StackElem __pyx_stack[1];
8012  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementNeighborsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8013  }
8014  __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[1];
8015  {
8016  __Pyx_BufFmt_StackElem __pyx_stack[1];
8017  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8018  }
8019  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
8020  {
8021  __Pyx_BufFmt_StackElem __pyx_stack[1];
8022  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_flin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8023  }
8024  __pyx_pybuffernd_q_flin.diminfo[0].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_flin.diminfo[0].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_flin.diminfo[1].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_flin.diminfo[1].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_flin.diminfo[2].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_flin.diminfo[2].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[2];
8025  {
8026  __Pyx_BufFmt_StackElem __pyx_stack[1];
8027  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_alin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8028  }
8029  __pyx_pybuffernd_q_alin.diminfo[0].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_alin.diminfo[0].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_alin.diminfo[1].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_alin.diminfo[1].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_alin.diminfo[2].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_alin.diminfo[2].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[2];
8030 
8031  /* "subsurfaceTransportFunctions.pyx":328
8032  * #temporaries
8033  * cdef int eN,eN_neighbor,ii,I,ebN,matID,matID_neig
8034  * cdef int nSpace2 = nSpace*nSpace # <<<<<<<<<<<<<<
8035  * cdef int nnz = rowptr[nSpace]
8036  *
8037  */
8038  __pyx_v_nSpace2 = (__pyx_v_nSpace * __pyx_v_nSpace);
8039 
8040  /* "subsurfaceTransportFunctions.pyx":329
8041  * cdef int eN,eN_neighbor,ii,I,ebN,matID,matID_neig
8042  * cdef int nSpace2 = nSpace*nSpace
8043  * cdef int nnz = rowptr[nSpace] # <<<<<<<<<<<<<<
8044  *
8045  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_eN = numpy.zeros(nnz,'d')
8046  */
8047  __pyx_t_1 = __pyx_v_nSpace;
8048  __pyx_t_2 = -1;
8049  if (__pyx_t_1 < 0) {
8050  __pyx_t_1 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
8051  if (unlikely(__pyx_t_1 < 0)) __pyx_t_2 = 0;
8052  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_2 = 0;
8053  if (unlikely(__pyx_t_2 != -1)) {
8054  __Pyx_RaiseBufferIndexError(__pyx_t_2);
8055  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8056  }
8057  __pyx_v_nnz = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_rowptr.diminfo[0].strides));
8058 
8059  /* "subsurfaceTransportFunctions.pyx":331
8060  * cdef int nnz = rowptr[nSpace]
8061  *
8062  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_eN = numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
8063  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_neig = numpy.zeros(nnz,'d')
8064  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_avg = numpy.zeros(nnz,'d')
8065  */
8066  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8067  __Pyx_GOTREF(__pyx_t_4);
8068  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8069  __Pyx_GOTREF(__pyx_t_5);
8070  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8071  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8072  __Pyx_GOTREF(__pyx_t_4);
8073  __pyx_t_6 = NULL;
8074  __pyx_t_7 = 0;
8075  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
8076  __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
8077  if (likely(__pyx_t_6)) {
8078  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
8079  __Pyx_INCREF(__pyx_t_6);
8080  __Pyx_INCREF(function);
8081  __Pyx_DECREF_SET(__pyx_t_5, function);
8082  __pyx_t_7 = 1;
8083  }
8084  }
8085  __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8086  __Pyx_GOTREF(__pyx_t_8);
8087  if (__pyx_t_6) {
8088  __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
8089  }
8090  __Pyx_GIVEREF(__pyx_t_4);
8091  PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_4);
8092  __Pyx_INCREF(__pyx_n_s_d);
8093  __Pyx_GIVEREF(__pyx_n_s_d);
8094  PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_n_s_d);
8095  __pyx_t_4 = 0;
8096  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8097  __Pyx_GOTREF(__pyx_t_3);
8098  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
8099  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8100  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8101  __pyx_t_9 = ((PyArrayObject *)__pyx_t_3);
8102  {
8103  __Pyx_BufFmt_StackElem __pyx_stack[1];
8104  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_eN.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
8105  __pyx_v_a_eN = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf = NULL;
8106  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8107  } else {__pyx_pybuffernd_a_eN.diminfo[0].strides = __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_eN.diminfo[0].shape = __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.shape[0];
8108  }
8109  }
8110  __pyx_t_9 = 0;
8111  __pyx_v_a_eN = ((PyArrayObject *)__pyx_t_3);
8112  __pyx_t_3 = 0;
8113 
8114  /* "subsurfaceTransportFunctions.pyx":332
8115  *
8116  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_eN = numpy.zeros(nnz,'d')
8117  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_neig = numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
8118  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_avg = numpy.zeros(nnz,'d')
8119  *
8120  */
8121  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8122  __Pyx_GOTREF(__pyx_t_5);
8123  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8124  __Pyx_GOTREF(__pyx_t_8);
8125  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8126  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8127  __Pyx_GOTREF(__pyx_t_5);
8128  __pyx_t_4 = NULL;
8129  __pyx_t_7 = 0;
8130  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_8))) {
8131  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8);
8132  if (likely(__pyx_t_4)) {
8133  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
8134  __Pyx_INCREF(__pyx_t_4);
8135  __Pyx_INCREF(function);
8136  __Pyx_DECREF_SET(__pyx_t_8, function);
8137  __pyx_t_7 = 1;
8138  }
8139  }
8140  __pyx_t_6 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8141  __Pyx_GOTREF(__pyx_t_6);
8142  if (__pyx_t_4) {
8143  __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
8144  }
8145  __Pyx_GIVEREF(__pyx_t_5);
8146  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_t_5);
8147  __Pyx_INCREF(__pyx_n_s_d);
8148  __Pyx_GIVEREF(__pyx_n_s_d);
8149  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_n_s_d);
8150  __pyx_t_5 = 0;
8151  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8152  __Pyx_GOTREF(__pyx_t_3);
8153  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8154  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
8155  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8156  __pyx_t_10 = ((PyArrayObject *)__pyx_t_3);
8157  {
8158  __Pyx_BufFmt_StackElem __pyx_stack[1];
8159  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_neig.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
8160  __pyx_v_a_neig = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf = NULL;
8161  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8162  } else {__pyx_pybuffernd_a_neig.diminfo[0].strides = __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_neig.diminfo[0].shape = __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.shape[0];
8163  }
8164  }
8165  __pyx_t_10 = 0;
8166  __pyx_v_a_neig = ((PyArrayObject *)__pyx_t_3);
8167  __pyx_t_3 = 0;
8168 
8169  /* "subsurfaceTransportFunctions.pyx":333
8170  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_eN = numpy.zeros(nnz,'d')
8171  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_neig = numpy.zeros(nnz,'d')
8172  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_avg = numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
8173  *
8174  * #loop through and evaluate
8175  */
8176  __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8177  __Pyx_GOTREF(__pyx_t_8);
8178  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8179  __Pyx_GOTREF(__pyx_t_6);
8180  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
8181  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8182  __Pyx_GOTREF(__pyx_t_8);
8183  __pyx_t_5 = NULL;
8184  __pyx_t_7 = 0;
8185  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_6))) {
8186  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
8187  if (likely(__pyx_t_5)) {
8188  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
8189  __Pyx_INCREF(__pyx_t_5);
8190  __Pyx_INCREF(function);
8191  __Pyx_DECREF_SET(__pyx_t_6, function);
8192  __pyx_t_7 = 1;
8193  }
8194  }
8195  __pyx_t_4 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8196  __Pyx_GOTREF(__pyx_t_4);
8197  if (__pyx_t_5) {
8198  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
8199  }
8200  __Pyx_GIVEREF(__pyx_t_8);
8201  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_7, __pyx_t_8);
8202  __Pyx_INCREF(__pyx_n_s_d);
8203  __Pyx_GIVEREF(__pyx_n_s_d);
8204  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_7, __pyx_n_s_d);
8205  __pyx_t_8 = 0;
8206  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8207  __Pyx_GOTREF(__pyx_t_3);
8208  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8209  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8210  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8211  __pyx_t_11 = ((PyArrayObject *)__pyx_t_3);
8212  {
8213  __Pyx_BufFmt_StackElem __pyx_stack[1];
8214  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_avg.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
8215  __pyx_v_a_avg = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.buf = NULL;
8216  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8217  } else {__pyx_pybuffernd_a_avg.diminfo[0].strides = __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_avg.diminfo[0].shape = __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.shape[0];
8218  }
8219  }
8220  __pyx_t_11 = 0;
8221  __pyx_v_a_avg = ((PyArrayObject *)__pyx_t_3);
8222  __pyx_t_3 = 0;
8223 
8224  /* "subsurfaceTransportFunctions.pyx":336
8225  *
8226  * #loop through and evaluate
8227  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
8228  * matID = elementMaterialTypes[eN]
8229  * for ii in range(nnz):
8230  */
8231  __pyx_t_2 = __pyx_v_nElements_global;
8232  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_2; __pyx_t_12+=1) {
8233  __pyx_v_eN = __pyx_t_12;
8234 
8235  /* "subsurfaceTransportFunctions.pyx":337
8236  * #loop through and evaluate
8237  * for eN in range(nElements_global):
8238  * matID = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
8239  * for ii in range(nnz):
8240  * a_eN[ii] = rho*KWs[matID,ii]
8241  */
8242  __pyx_t_13 = __pyx_v_eN;
8243  __pyx_t_14 = -1;
8244  if (__pyx_t_13 < 0) {
8245  __pyx_t_13 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
8246  if (unlikely(__pyx_t_13 < 0)) __pyx_t_14 = 0;
8247  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_14 = 0;
8248  if (unlikely(__pyx_t_14 != -1)) {
8249  __Pyx_RaiseBufferIndexError(__pyx_t_14);
8250  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8251  }
8252  __pyx_v_matID = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
8253 
8254  /* "subsurfaceTransportFunctions.pyx":338
8255  * for eN in range(nElements_global):
8256  * matID = elementMaterialTypes[eN]
8257  * for ii in range(nnz): # <<<<<<<<<<<<<<
8258  * a_eN[ii] = rho*KWs[matID,ii]
8259  * for ebN in range(nElementBoundaries_element):
8260  */
8261  __pyx_t_14 = __pyx_v_nnz;
8262  for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
8263  __pyx_v_ii = __pyx_t_15;
8264 
8265  /* "subsurfaceTransportFunctions.pyx":339
8266  * matID = elementMaterialTypes[eN]
8267  * for ii in range(nnz):
8268  * a_eN[ii] = rho*KWs[matID,ii] # <<<<<<<<<<<<<<
8269  * for ebN in range(nElementBoundaries_element):
8270  * eN_neighbor = elementNeighborsArray[eN,ebN]
8271  */
8272  __pyx_t_16 = __pyx_v_matID;
8273  __pyx_t_17 = __pyx_v_ii;
8274  __pyx_t_18 = -1;
8275  if (__pyx_t_16 < 0) {
8276  __pyx_t_16 += __pyx_pybuffernd_KWs.diminfo[0].shape;
8277  if (unlikely(__pyx_t_16 < 0)) __pyx_t_18 = 0;
8278  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_KWs.diminfo[0].shape)) __pyx_t_18 = 0;
8279  if (__pyx_t_17 < 0) {
8280  __pyx_t_17 += __pyx_pybuffernd_KWs.diminfo[1].shape;
8281  if (unlikely(__pyx_t_17 < 0)) __pyx_t_18 = 1;
8282  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_KWs.diminfo[1].shape)) __pyx_t_18 = 1;
8283  if (unlikely(__pyx_t_18 != -1)) {
8284  __Pyx_RaiseBufferIndexError(__pyx_t_18);
8285  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8286  }
8287  __pyx_t_19 = __pyx_v_ii;
8288  __pyx_t_18 = -1;
8289  if (__pyx_t_19 < 0) {
8290  __pyx_t_19 += __pyx_pybuffernd_a_eN.diminfo[0].shape;
8291  if (unlikely(__pyx_t_19 < 0)) __pyx_t_18 = 0;
8292  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_a_eN.diminfo[0].shape)) __pyx_t_18 = 0;
8293  if (unlikely(__pyx_t_18 != -1)) {
8294  __Pyx_RaiseBufferIndexError(__pyx_t_18);
8295  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8296  }
8297  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_a_eN.diminfo[0].strides) = (__pyx_v_rho * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_KWs.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_KWs.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_KWs.diminfo[1].strides)));
8298  }
8299 
8300  /* "subsurfaceTransportFunctions.pyx":340
8301  * for ii in range(nnz):
8302  * a_eN[ii] = rho*KWs[matID,ii]
8303  * for ebN in range(nElementBoundaries_element): # <<<<<<<<<<<<<<
8304  * eN_neighbor = elementNeighborsArray[eN,ebN]
8305  * for ii in range(nnz):
8306  */
8307  __pyx_t_14 = __pyx_v_nElementBoundaries_element;
8308  for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
8309  __pyx_v_ebN = __pyx_t_15;
8310 
8311  /* "subsurfaceTransportFunctions.pyx":341
8312  * a_eN[ii] = rho*KWs[matID,ii]
8313  * for ebN in range(nElementBoundaries_element):
8314  * eN_neighbor = elementNeighborsArray[eN,ebN] # <<<<<<<<<<<<<<
8315  * for ii in range(nnz):
8316  * a_neig[ii] = a_eN[ii]
8317  */
8318  __pyx_t_20 = __pyx_v_eN;
8319  __pyx_t_21 = __pyx_v_ebN;
8320  __pyx_t_18 = -1;
8321  if (__pyx_t_20 < 0) {
8322  __pyx_t_20 += __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape;
8323  if (unlikely(__pyx_t_20 < 0)) __pyx_t_18 = 0;
8324  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape)) __pyx_t_18 = 0;
8325  if (__pyx_t_21 < 0) {
8326  __pyx_t_21 += __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape;
8327  if (unlikely(__pyx_t_21 < 0)) __pyx_t_18 = 1;
8328  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape)) __pyx_t_18 = 1;
8329  if (unlikely(__pyx_t_18 != -1)) {
8330  __Pyx_RaiseBufferIndexError(__pyx_t_18);
8331  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8332  }
8333  __pyx_v_eN_neighbor = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides));
8334 
8335  /* "subsurfaceTransportFunctions.pyx":342
8336  * for ebN in range(nElementBoundaries_element):
8337  * eN_neighbor = elementNeighborsArray[eN,ebN]
8338  * for ii in range(nnz): # <<<<<<<<<<<<<<
8339  * a_neig[ii] = a_eN[ii]
8340  * if eN_neighbor >= 0:
8341  */
8342  __pyx_t_18 = __pyx_v_nnz;
8343  for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_18; __pyx_t_22+=1) {
8344  __pyx_v_ii = __pyx_t_22;
8345 
8346  /* "subsurfaceTransportFunctions.pyx":343
8347  * eN_neighbor = elementNeighborsArray[eN,ebN]
8348  * for ii in range(nnz):
8349  * a_neig[ii] = a_eN[ii] # <<<<<<<<<<<<<<
8350  * if eN_neighbor >= 0:
8351  * matID_neig = elementMaterialTypes[eN_neighbor]
8352  */
8353  __pyx_t_23 = __pyx_v_ii;
8354  __pyx_t_24 = -1;
8355  if (__pyx_t_23 < 0) {
8356  __pyx_t_23 += __pyx_pybuffernd_a_eN.diminfo[0].shape;
8357  if (unlikely(__pyx_t_23 < 0)) __pyx_t_24 = 0;
8358  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_a_eN.diminfo[0].shape)) __pyx_t_24 = 0;
8359  if (unlikely(__pyx_t_24 != -1)) {
8360  __Pyx_RaiseBufferIndexError(__pyx_t_24);
8361  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8362  }
8363  __pyx_t_25 = __pyx_v_ii;
8364  __pyx_t_24 = -1;
8365  if (__pyx_t_25 < 0) {
8366  __pyx_t_25 += __pyx_pybuffernd_a_neig.diminfo[0].shape;
8367  if (unlikely(__pyx_t_25 < 0)) __pyx_t_24 = 0;
8368  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_a_neig.diminfo[0].shape)) __pyx_t_24 = 0;
8369  if (unlikely(__pyx_t_24 != -1)) {
8370  __Pyx_RaiseBufferIndexError(__pyx_t_24);
8371  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8372  }
8373  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_a_neig.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_a_eN.diminfo[0].strides));
8374  }
8375 
8376  /* "subsurfaceTransportFunctions.pyx":344
8377  * for ii in range(nnz):
8378  * a_neig[ii] = a_eN[ii]
8379  * if eN_neighbor >= 0: # <<<<<<<<<<<<<<
8380  * matID_neig = elementMaterialTypes[eN_neighbor]
8381  * for ii in range(nnz):
8382  */
8383  __pyx_t_26 = ((__pyx_v_eN_neighbor >= 0) != 0);
8384  if (__pyx_t_26) {
8385 
8386  /* "subsurfaceTransportFunctions.pyx":345
8387  * a_neig[ii] = a_eN[ii]
8388  * if eN_neighbor >= 0:
8389  * matID_neig = elementMaterialTypes[eN_neighbor] # <<<<<<<<<<<<<<
8390  * for ii in range(nnz):
8391  * a_neig[ii] = rho*KWs[matID_neig,ii]
8392  */
8393  __pyx_t_27 = __pyx_v_eN_neighbor;
8394  __pyx_t_18 = -1;
8395  if (__pyx_t_27 < 0) {
8396  __pyx_t_27 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
8397  if (unlikely(__pyx_t_27 < 0)) __pyx_t_18 = 0;
8398  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_18 = 0;
8399  if (unlikely(__pyx_t_18 != -1)) {
8400  __Pyx_RaiseBufferIndexError(__pyx_t_18);
8401  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8402  }
8403  __pyx_v_matID_neig = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
8404 
8405  /* "subsurfaceTransportFunctions.pyx":346
8406  * if eN_neighbor >= 0:
8407  * matID_neig = elementMaterialTypes[eN_neighbor]
8408  * for ii in range(nnz): # <<<<<<<<<<<<<<
8409  * a_neig[ii] = rho*KWs[matID_neig,ii]
8410  * for ii in range(nnz):
8411  */
8412  __pyx_t_18 = __pyx_v_nnz;
8413  for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_18; __pyx_t_22+=1) {
8414  __pyx_v_ii = __pyx_t_22;
8415 
8416  /* "subsurfaceTransportFunctions.pyx":347
8417  * matID_neig = elementMaterialTypes[eN_neighbor]
8418  * for ii in range(nnz):
8419  * a_neig[ii] = rho*KWs[matID_neig,ii] # <<<<<<<<<<<<<<
8420  * for ii in range(nnz):
8421  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20)
8422  */
8423  __pyx_t_28 = __pyx_v_matID_neig;
8424  __pyx_t_29 = __pyx_v_ii;
8425  __pyx_t_24 = -1;
8426  if (__pyx_t_28 < 0) {
8427  __pyx_t_28 += __pyx_pybuffernd_KWs.diminfo[0].shape;
8428  if (unlikely(__pyx_t_28 < 0)) __pyx_t_24 = 0;
8429  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_KWs.diminfo[0].shape)) __pyx_t_24 = 0;
8430  if (__pyx_t_29 < 0) {
8431  __pyx_t_29 += __pyx_pybuffernd_KWs.diminfo[1].shape;
8432  if (unlikely(__pyx_t_29 < 0)) __pyx_t_24 = 1;
8433  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_KWs.diminfo[1].shape)) __pyx_t_24 = 1;
8434  if (unlikely(__pyx_t_24 != -1)) {
8435  __Pyx_RaiseBufferIndexError(__pyx_t_24);
8436  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8437  }
8438  __pyx_t_30 = __pyx_v_ii;
8439  __pyx_t_24 = -1;
8440  if (__pyx_t_30 < 0) {
8441  __pyx_t_30 += __pyx_pybuffernd_a_neig.diminfo[0].shape;
8442  if (unlikely(__pyx_t_30 < 0)) __pyx_t_24 = 0;
8443  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_a_neig.diminfo[0].shape)) __pyx_t_24 = 0;
8444  if (unlikely(__pyx_t_24 != -1)) {
8445  __Pyx_RaiseBufferIndexError(__pyx_t_24);
8446  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8447  }
8448  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_a_neig.diminfo[0].strides) = (__pyx_v_rho * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_KWs.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_KWs.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_KWs.diminfo[1].strides)));
8449  }
8450 
8451  /* "subsurfaceTransportFunctions.pyx":344
8452  * for ii in range(nnz):
8453  * a_neig[ii] = a_eN[ii]
8454  * if eN_neighbor >= 0: # <<<<<<<<<<<<<<
8455  * matID_neig = elementMaterialTypes[eN_neighbor]
8456  * for ii in range(nnz):
8457  */
8458  }
8459 
8460  /* "subsurfaceTransportFunctions.pyx":348
8461  * for ii in range(nnz):
8462  * a_neig[ii] = rho*KWs[matID_neig,ii]
8463  * for ii in range(nnz): # <<<<<<<<<<<<<<
8464  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20)
8465  * q_alin[eN,ebN,ii] = a_avg[ii]
8466  */
8467  __pyx_t_18 = __pyx_v_nnz;
8468  for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_18; __pyx_t_22+=1) {
8469  __pyx_v_ii = __pyx_t_22;
8470 
8471  /* "subsurfaceTransportFunctions.pyx":349
8472  * a_neig[ii] = rho*KWs[matID_neig,ii]
8473  * for ii in range(nnz):
8474  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20) # <<<<<<<<<<<<<<
8475  * q_alin[eN,ebN,ii] = a_avg[ii]
8476  * for I in range(nSpace):
8477  */
8478  __pyx_t_31 = __pyx_v_ii;
8479  __pyx_t_24 = -1;
8480  if (__pyx_t_31 < 0) {
8481  __pyx_t_31 += __pyx_pybuffernd_a_eN.diminfo[0].shape;
8482  if (unlikely(__pyx_t_31 < 0)) __pyx_t_24 = 0;
8483  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_a_eN.diminfo[0].shape)) __pyx_t_24 = 0;
8484  if (unlikely(__pyx_t_24 != -1)) {
8485  __Pyx_RaiseBufferIndexError(__pyx_t_24);
8486  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8487  }
8488  __pyx_t_32 = __pyx_v_ii;
8489  __pyx_t_24 = -1;
8490  if (__pyx_t_32 < 0) {
8491  __pyx_t_32 += __pyx_pybuffernd_a_neig.diminfo[0].shape;
8492  if (unlikely(__pyx_t_32 < 0)) __pyx_t_24 = 0;
8493  } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_a_neig.diminfo[0].shape)) __pyx_t_24 = 0;
8494  if (unlikely(__pyx_t_24 != -1)) {
8495  __Pyx_RaiseBufferIndexError(__pyx_t_24);
8496  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8497  }
8498  __pyx_t_33 = ((2.0 * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_a_eN.diminfo[0].strides))) * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_a_neig.diminfo[0].strides)));
8499  __pyx_t_34 = __pyx_v_ii;
8500  __pyx_t_24 = -1;
8501  if (__pyx_t_34 < 0) {
8502  __pyx_t_34 += __pyx_pybuffernd_a_eN.diminfo[0].shape;
8503  if (unlikely(__pyx_t_34 < 0)) __pyx_t_24 = 0;
8504  } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_a_eN.diminfo[0].shape)) __pyx_t_24 = 0;
8505  if (unlikely(__pyx_t_24 != -1)) {
8506  __Pyx_RaiseBufferIndexError(__pyx_t_24);
8507  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8508  }
8509  __pyx_t_35 = __pyx_v_ii;
8510  __pyx_t_24 = -1;
8511  if (__pyx_t_35 < 0) {
8512  __pyx_t_35 += __pyx_pybuffernd_a_neig.diminfo[0].shape;
8513  if (unlikely(__pyx_t_35 < 0)) __pyx_t_24 = 0;
8514  } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_a_neig.diminfo[0].shape)) __pyx_t_24 = 0;
8515  if (unlikely(__pyx_t_24 != -1)) {
8516  __Pyx_RaiseBufferIndexError(__pyx_t_24);
8517  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8518  }
8519  __pyx_t_36 = (((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_a_eN.diminfo[0].strides)) + (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_a_neig.diminfo[0].strides))) + 1.0e-20);
8520  if (unlikely(__pyx_t_36 == 0)) {
8521  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
8522  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8523  }
8524  __pyx_t_37 = __pyx_v_ii;
8525  __pyx_t_24 = -1;
8526  if (__pyx_t_37 < 0) {
8527  __pyx_t_37 += __pyx_pybuffernd_a_avg.diminfo[0].shape;
8528  if (unlikely(__pyx_t_37 < 0)) __pyx_t_24 = 0;
8529  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_a_avg.diminfo[0].shape)) __pyx_t_24 = 0;
8530  if (unlikely(__pyx_t_24 != -1)) {
8531  __Pyx_RaiseBufferIndexError(__pyx_t_24);
8532  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8533  }
8534  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_a_avg.diminfo[0].strides) = (__pyx_t_33 / __pyx_t_36);
8535 
8536  /* "subsurfaceTransportFunctions.pyx":350
8537  * for ii in range(nnz):
8538  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20)
8539  * q_alin[eN,ebN,ii] = a_avg[ii] # <<<<<<<<<<<<<<
8540  * for I in range(nSpace):
8541  * q_flin[eN,ebN,I] = 0.0
8542  */
8543  __pyx_t_38 = __pyx_v_ii;
8544  __pyx_t_24 = -1;
8545  if (__pyx_t_38 < 0) {
8546  __pyx_t_38 += __pyx_pybuffernd_a_avg.diminfo[0].shape;
8547  if (unlikely(__pyx_t_38 < 0)) __pyx_t_24 = 0;
8548  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_a_avg.diminfo[0].shape)) __pyx_t_24 = 0;
8549  if (unlikely(__pyx_t_24 != -1)) {
8550  __Pyx_RaiseBufferIndexError(__pyx_t_24);
8551  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8552  }
8553  __pyx_t_39 = __pyx_v_eN;
8554  __pyx_t_40 = __pyx_v_ebN;
8555  __pyx_t_41 = __pyx_v_ii;
8556  __pyx_t_24 = -1;
8557  if (__pyx_t_39 < 0) {
8558  __pyx_t_39 += __pyx_pybuffernd_q_alin.diminfo[0].shape;
8559  if (unlikely(__pyx_t_39 < 0)) __pyx_t_24 = 0;
8560  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_q_alin.diminfo[0].shape)) __pyx_t_24 = 0;
8561  if (__pyx_t_40 < 0) {
8562  __pyx_t_40 += __pyx_pybuffernd_q_alin.diminfo[1].shape;
8563  if (unlikely(__pyx_t_40 < 0)) __pyx_t_24 = 1;
8564  } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_q_alin.diminfo[1].shape)) __pyx_t_24 = 1;
8565  if (__pyx_t_41 < 0) {
8566  __pyx_t_41 += __pyx_pybuffernd_q_alin.diminfo[2].shape;
8567  if (unlikely(__pyx_t_41 < 0)) __pyx_t_24 = 2;
8568  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_q_alin.diminfo[2].shape)) __pyx_t_24 = 2;
8569  if (unlikely(__pyx_t_24 != -1)) {
8570  __Pyx_RaiseBufferIndexError(__pyx_t_24);
8571  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8572  }
8573  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_q_alin.diminfo[0].strides, __pyx_t_40, __pyx_pybuffernd_q_alin.diminfo[1].strides, __pyx_t_41, __pyx_pybuffernd_q_alin.diminfo[2].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_a_avg.diminfo[0].strides));
8574  }
8575 
8576  /* "subsurfaceTransportFunctions.pyx":351
8577  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20)
8578  * q_alin[eN,ebN,ii] = a_avg[ii]
8579  * for I in range(nSpace): # <<<<<<<<<<<<<<
8580  * q_flin[eN,ebN,I] = 0.0
8581  * for ii in range(rowptr[I],rowptr[I+1]):
8582  */
8583  __pyx_t_18 = __pyx_v_nSpace;
8584  for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_18; __pyx_t_22+=1) {
8585  __pyx_v_I = __pyx_t_22;
8586 
8587  /* "subsurfaceTransportFunctions.pyx":352
8588  * q_alin[eN,ebN,ii] = a_avg[ii]
8589  * for I in range(nSpace):
8590  * q_flin[eN,ebN,I] = 0.0 # <<<<<<<<<<<<<<
8591  * for ii in range(rowptr[I],rowptr[I+1]):
8592  * q_flin[eN,ebN,I] += rho*a_avg[ii]*gravity[colind[ii]]
8593  */
8594  __pyx_t_42 = __pyx_v_eN;
8595  __pyx_t_43 = __pyx_v_ebN;
8596  __pyx_t_44 = __pyx_v_I;
8597  __pyx_t_24 = -1;
8598  if (__pyx_t_42 < 0) {
8599  __pyx_t_42 += __pyx_pybuffernd_q_flin.diminfo[0].shape;
8600  if (unlikely(__pyx_t_42 < 0)) __pyx_t_24 = 0;
8601  } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_q_flin.diminfo[0].shape)) __pyx_t_24 = 0;
8602  if (__pyx_t_43 < 0) {
8603  __pyx_t_43 += __pyx_pybuffernd_q_flin.diminfo[1].shape;
8604  if (unlikely(__pyx_t_43 < 0)) __pyx_t_24 = 1;
8605  } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_q_flin.diminfo[1].shape)) __pyx_t_24 = 1;
8606  if (__pyx_t_44 < 0) {
8607  __pyx_t_44 += __pyx_pybuffernd_q_flin.diminfo[2].shape;
8608  if (unlikely(__pyx_t_44 < 0)) __pyx_t_24 = 2;
8609  } else if (unlikely(__pyx_t_44 >= __pyx_pybuffernd_q_flin.diminfo[2].shape)) __pyx_t_24 = 2;
8610  if (unlikely(__pyx_t_24 != -1)) {
8611  __Pyx_RaiseBufferIndexError(__pyx_t_24);
8612  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8613  }
8614  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_q_flin.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_q_flin.diminfo[1].strides, __pyx_t_44, __pyx_pybuffernd_q_flin.diminfo[2].strides) = 0.0;
8615 
8616  /* "subsurfaceTransportFunctions.pyx":353
8617  * for I in range(nSpace):
8618  * q_flin[eN,ebN,I] = 0.0
8619  * for ii in range(rowptr[I],rowptr[I+1]): # <<<<<<<<<<<<<<
8620  * q_flin[eN,ebN,I] += rho*a_avg[ii]*gravity[colind[ii]]
8621  * #ebN
8622  */
8623  __pyx_t_45 = (__pyx_v_I + 1);
8624  __pyx_t_24 = -1;
8625  if (__pyx_t_45 < 0) {
8626  __pyx_t_45 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
8627  if (unlikely(__pyx_t_45 < 0)) __pyx_t_24 = 0;
8628  } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_24 = 0;
8629  if (unlikely(__pyx_t_24 != -1)) {
8630  __Pyx_RaiseBufferIndexError(__pyx_t_24);
8631  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8632  }
8633  __pyx_t_46 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_rowptr.diminfo[0].strides));
8634  __pyx_t_47 = __pyx_v_I;
8635  __pyx_t_24 = -1;
8636  if (__pyx_t_47 < 0) {
8637  __pyx_t_47 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
8638  if (unlikely(__pyx_t_47 < 0)) __pyx_t_24 = 0;
8639  } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_24 = 0;
8640  if (unlikely(__pyx_t_24 != -1)) {
8641  __Pyx_RaiseBufferIndexError(__pyx_t_24);
8642  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8643  }
8644  for (__pyx_t_24 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_rowptr.diminfo[0].strides)); __pyx_t_24 < __pyx_t_46; __pyx_t_24+=1) {
8645  __pyx_v_ii = __pyx_t_24;
8646 
8647  /* "subsurfaceTransportFunctions.pyx":354
8648  * q_flin[eN,ebN,I] = 0.0
8649  * for ii in range(rowptr[I],rowptr[I+1]):
8650  * q_flin[eN,ebN,I] += rho*a_avg[ii]*gravity[colind[ii]] # <<<<<<<<<<<<<<
8651  * #ebN
8652  * #eN
8653  */
8654  __pyx_t_48 = __pyx_v_ii;
8655  __pyx_t_49 = -1;
8656  if (__pyx_t_48 < 0) {
8657  __pyx_t_48 += __pyx_pybuffernd_a_avg.diminfo[0].shape;
8658  if (unlikely(__pyx_t_48 < 0)) __pyx_t_49 = 0;
8659  } else if (unlikely(__pyx_t_48 >= __pyx_pybuffernd_a_avg.diminfo[0].shape)) __pyx_t_49 = 0;
8660  if (unlikely(__pyx_t_49 != -1)) {
8661  __Pyx_RaiseBufferIndexError(__pyx_t_49);
8662  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8663  }
8664  __pyx_t_50 = __pyx_v_ii;
8665  __pyx_t_49 = -1;
8666  if (__pyx_t_50 < 0) {
8667  __pyx_t_50 += __pyx_pybuffernd_colind.diminfo[0].shape;
8668  if (unlikely(__pyx_t_50 < 0)) __pyx_t_49 = 0;
8669  } else if (unlikely(__pyx_t_50 >= __pyx_pybuffernd_colind.diminfo[0].shape)) __pyx_t_49 = 0;
8670  if (unlikely(__pyx_t_49 != -1)) {
8671  __Pyx_RaiseBufferIndexError(__pyx_t_49);
8672  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8673  }
8674  __pyx_t_51 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_colind.rcbuffer->pybuffer.buf, __pyx_t_50, __pyx_pybuffernd_colind.diminfo[0].strides));
8675  __pyx_t_49 = -1;
8676  if (__pyx_t_51 < 0) {
8677  __pyx_t_51 += __pyx_pybuffernd_gravity.diminfo[0].shape;
8678  if (unlikely(__pyx_t_51 < 0)) __pyx_t_49 = 0;
8679  } else if (unlikely(__pyx_t_51 >= __pyx_pybuffernd_gravity.diminfo[0].shape)) __pyx_t_49 = 0;
8680  if (unlikely(__pyx_t_49 != -1)) {
8681  __Pyx_RaiseBufferIndexError(__pyx_t_49);
8682  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8683  }
8684  __pyx_t_52 = __pyx_v_eN;
8685  __pyx_t_53 = __pyx_v_ebN;
8686  __pyx_t_54 = __pyx_v_I;
8687  __pyx_t_49 = -1;
8688  if (__pyx_t_52 < 0) {
8689  __pyx_t_52 += __pyx_pybuffernd_q_flin.diminfo[0].shape;
8690  if (unlikely(__pyx_t_52 < 0)) __pyx_t_49 = 0;
8691  } else if (unlikely(__pyx_t_52 >= __pyx_pybuffernd_q_flin.diminfo[0].shape)) __pyx_t_49 = 0;
8692  if (__pyx_t_53 < 0) {
8693  __pyx_t_53 += __pyx_pybuffernd_q_flin.diminfo[1].shape;
8694  if (unlikely(__pyx_t_53 < 0)) __pyx_t_49 = 1;
8695  } else if (unlikely(__pyx_t_53 >= __pyx_pybuffernd_q_flin.diminfo[1].shape)) __pyx_t_49 = 1;
8696  if (__pyx_t_54 < 0) {
8697  __pyx_t_54 += __pyx_pybuffernd_q_flin.diminfo[2].shape;
8698  if (unlikely(__pyx_t_54 < 0)) __pyx_t_49 = 2;
8699  } else if (unlikely(__pyx_t_54 >= __pyx_pybuffernd_q_flin.diminfo[2].shape)) __pyx_t_49 = 2;
8700  if (unlikely(__pyx_t_49 != -1)) {
8701  __Pyx_RaiseBufferIndexError(__pyx_t_49);
8702  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8703  }
8704  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.buf, __pyx_t_52, __pyx_pybuffernd_q_flin.diminfo[0].strides, __pyx_t_53, __pyx_pybuffernd_q_flin.diminfo[1].strides, __pyx_t_54, __pyx_pybuffernd_q_flin.diminfo[2].strides) += ((__pyx_v_rho * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_a_avg.diminfo[0].strides))) * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_gravity.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_gravity.diminfo[0].strides)));
8705  }
8706  }
8707  }
8708  }
8709 
8710  /* "subsurfaceTransportFunctions.pyx":301
8711  *
8712  * ##################################################
8713  * def RE_NCP1_evaluateElementCoefficients_Linear(double rho, # <<<<<<<<<<<<<<
8714  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
8715  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
8716  */
8717 
8718  /* function exit code */
8719  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8720  goto __pyx_L0;
8721  __pyx_L1_error:;
8722  __Pyx_XDECREF(__pyx_t_3);
8723  __Pyx_XDECREF(__pyx_t_4);
8724  __Pyx_XDECREF(__pyx_t_5);
8725  __Pyx_XDECREF(__pyx_t_6);
8726  __Pyx_XDECREF(__pyx_t_8);
8727  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
8728  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
8729  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_KWs.rcbuffer->pybuffer);
8730  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_avg.rcbuffer->pybuffer);
8731  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_eN.rcbuffer->pybuffer);
8732  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_neig.rcbuffer->pybuffer);
8733  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
8734  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
8735  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
8736  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
8737  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
8738  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
8739  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
8740  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
8741  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_evaluateElementCoefficients_Linear", __pyx_clineno, __pyx_lineno, __pyx_filename);
8742  __pyx_r = NULL;
8743  goto __pyx_L2;
8744  __pyx_L0:;
8745  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_KWs.rcbuffer->pybuffer);
8746  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_avg.rcbuffer->pybuffer);
8747  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_eN.rcbuffer->pybuffer);
8748  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_neig.rcbuffer->pybuffer);
8749  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
8750  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
8751  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
8752  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
8753  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
8754  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
8755  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
8756  __pyx_L2:;
8757  __Pyx_XDECREF((PyObject *)__pyx_v_a_eN);
8758  __Pyx_XDECREF((PyObject *)__pyx_v_a_neig);
8759  __Pyx_XDECREF((PyObject *)__pyx_v_a_avg);
8760  __Pyx_XGIVEREF(__pyx_r);
8761  __Pyx_RefNannyFinishContext();
8762  return __pyx_r;
8763 }
8764 
8765 /* "subsurfaceTransportFunctions.pyx":359
8766  *
8767  *
8768  * def RE_NCP1_evaluateElementCoefficients_VGM(double rho, # <<<<<<<<<<<<<<
8769  * double beta,
8770  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
8771  */
8772 
8773 /* Python wrapper */
8774 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8775 static char __pyx_doc_28subsurfaceTransportFunctions_30RE_NCP1_evaluateElementCoefficients_VGM[] = "\n routine for evaluating nodal coefficients in NCP1 approximation for conservative head formulation of Richards equation \n\n Approximation:\n uses nodal quadrature where the nodes are face barycenters\n uses harmonic average for intrinsic permeability/ hydraulic conductivity\n assumes slight compressiblity for now\n\n TODO:\n everything\n \n ";
8776 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM = {"RE_NCP1_evaluateElementCoefficients_VGM", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_30RE_NCP1_evaluateElementCoefficients_VGM};
8777 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8778  double __pyx_v_rho;
8779  double __pyx_v_beta;
8780  PyArrayObject *__pyx_v_gravity = 0;
8781  PyArrayObject *__pyx_v_alpha = 0;
8782  PyArrayObject *__pyx_v_n = 0;
8783  PyArrayObject *__pyx_v_thetaR = 0;
8784  PyArrayObject *__pyx_v_thetaSR = 0;
8785  int __pyx_v_nSpace;
8786  int __pyx_v_nElements_global;
8787  int __pyx_v_nElementBoundaries_element;
8788  PyArrayObject *__pyx_v_elementNeighborsArray = 0;
8789  PyArrayObject *__pyx_v_elementBarycentersArray = 0;
8790  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
8791  int __pyx_v_nDOF_trial_element;
8792  PyArrayObject *__pyx_v_u_l2g = 0;
8793  PyArrayObject *__pyx_v_u_dof = 0;
8794  CYTHON_UNUSED PyArrayObject *__pyx_v_q_x = 0;
8795  PyArrayObject *__pyx_v_q_u = 0;
8796  PyArrayObject *__pyx_v_q_mass = 0;
8797  PyArrayObject *__pyx_v_q_dmass = 0;
8798  PyArrayObject *__pyx_v_q_r = 0;
8799  PyArrayObject *__pyx_v_q_kr = 0;
8800  PyArrayObject *__pyx_v_q_dkr = 0;
8801  PyArrayObject *__pyx_v_q_kr_up = 0;
8802  int __pyx_lineno = 0;
8803  const char *__pyx_filename = NULL;
8804  int __pyx_clineno = 0;
8805  PyObject *__pyx_r = 0;
8806  __Pyx_RefNannyDeclarations
8807  __Pyx_RefNannySetupContext("RE_NCP1_evaluateElementCoefficients_VGM (wrapper)", 0);
8808  {
8809  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rho,&__pyx_n_s_beta,&__pyx_n_s_gravity,&__pyx_n_s_alpha,&__pyx_n_s_n,&__pyx_n_s_thetaR,&__pyx_n_s_thetaSR,&__pyx_n_s_nSpace,&__pyx_n_s_nElements_global,&__pyx_n_s_nElementBoundaries_element,&__pyx_n_s_elementNeighborsArray,&__pyx_n_s_elementBarycentersArray,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_nDOF_trial_element,&__pyx_n_s_u_l2g,&__pyx_n_s_u_dof,&__pyx_n_s_q_x,&__pyx_n_s_q_u,&__pyx_n_s_q_mass,&__pyx_n_s_q_dmass,&__pyx_n_s_q_r,&__pyx_n_s_q_kr,&__pyx_n_s_q_dkr,&__pyx_n_s_q_kr_up,0};
8810  PyObject* values[24] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
8811  if (unlikely(__pyx_kwds)) {
8812  Py_ssize_t kw_args;
8813  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8814  switch (pos_args) {
8815  case 24: values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
8816  case 23: values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
8817  case 22: values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
8818  case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
8819  case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
8820  case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
8821  case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
8822  case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
8823  case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
8824  case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
8825  case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
8826  case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
8827  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
8828  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
8829  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
8830  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
8831  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
8832  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
8833  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
8834  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8835  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8836  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8837  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8838  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8839  case 0: break;
8840  default: goto __pyx_L5_argtuple_error;
8841  }
8842  kw_args = PyDict_Size(__pyx_kwds);
8843  switch (pos_args) {
8844  case 0:
8845  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rho)) != 0)) kw_args--;
8846  else goto __pyx_L5_argtuple_error;
8847  case 1:
8848  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_beta)) != 0)) kw_args--;
8849  else {
8850  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8851  }
8852  case 2:
8853  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_gravity)) != 0)) kw_args--;
8854  else {
8855  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8856  }
8857  case 3:
8858  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
8859  else {
8860  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8861  }
8862  case 4:
8863  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
8864  else {
8865  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8866  }
8867  case 5:
8868  if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_thetaR)) != 0)) kw_args--;
8869  else {
8870  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8871  }
8872  case 6:
8873  if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_thetaSR)) != 0)) kw_args--;
8874  else {
8875  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8876  }
8877  case 7:
8878  if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nSpace)) != 0)) kw_args--;
8879  else {
8880  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8881  }
8882  case 8:
8883  if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nElements_global)) != 0)) kw_args--;
8884  else {
8885  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8886  }
8887  case 9:
8888  if (likely((values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nElementBoundaries_element)) != 0)) kw_args--;
8889  else {
8890  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8891  }
8892  case 10:
8893  if (likely((values[10] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementNeighborsArray)) != 0)) kw_args--;
8894  else {
8895  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 10); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8896  }
8897  case 11:
8898  if (likely((values[11] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
8899  else {
8900  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 11); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8901  }
8902  case 12:
8903  if (likely((values[12] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
8904  else {
8905  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 12); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8906  }
8907  case 13:
8908  if (likely((values[13] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nDOF_trial_element)) != 0)) kw_args--;
8909  else {
8910  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 13); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8911  }
8912  case 14:
8913  if (likely((values[14] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_u_l2g)) != 0)) kw_args--;
8914  else {
8915  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 14); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8916  }
8917  case 15:
8918  if (likely((values[15] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_u_dof)) != 0)) kw_args--;
8919  else {
8920  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 15); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8921  }
8922  case 16:
8923  if (likely((values[16] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_x)) != 0)) kw_args--;
8924  else {
8925  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 16); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8926  }
8927  case 17:
8928  if (likely((values[17] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_u)) != 0)) kw_args--;
8929  else {
8930  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 17); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8931  }
8932  case 18:
8933  if (likely((values[18] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_mass)) != 0)) kw_args--;
8934  else {
8935  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 18); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8936  }
8937  case 19:
8938  if (likely((values[19] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_dmass)) != 0)) kw_args--;
8939  else {
8940  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 19); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8941  }
8942  case 20:
8943  if (likely((values[20] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_r)) != 0)) kw_args--;
8944  else {
8945  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 20); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8946  }
8947  case 21:
8948  if (likely((values[21] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_kr)) != 0)) kw_args--;
8949  else {
8950  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 21); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8951  }
8952  case 22:
8953  if (likely((values[22] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_dkr)) != 0)) kw_args--;
8954  else {
8955  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 22); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8956  }
8957  case 23:
8958  if (likely((values[23] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_kr_up)) != 0)) kw_args--;
8959  else {
8960  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 23); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8961  }
8962  }
8963  if (unlikely(kw_args > 0)) {
8964  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RE_NCP1_evaluateElementCoefficients_VGM") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8965  }
8966  } else if (PyTuple_GET_SIZE(__pyx_args) != 24) {
8967  goto __pyx_L5_argtuple_error;
8968  } else {
8969  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8970  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8971  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8972  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8973  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8974  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
8975  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
8976  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
8977  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
8978  values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
8979  values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
8980  values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
8981  values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
8982  values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
8983  values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
8984  values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
8985  values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
8986  values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
8987  values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
8988  values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
8989  values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
8990  values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
8991  values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
8992  values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
8993  }
8994  __pyx_v_rho = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_rho == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8995  __pyx_v_beta = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_beta == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8996  __pyx_v_gravity = ((PyArrayObject *)values[2]);
8997  __pyx_v_alpha = ((PyArrayObject *)values[3]);
8998  __pyx_v_n = ((PyArrayObject *)values[4]);
8999  __pyx_v_thetaR = ((PyArrayObject *)values[5]);
9000  __pyx_v_thetaSR = ((PyArrayObject *)values[6]);
9001  __pyx_v_nSpace = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_nSpace == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
9002  __pyx_v_nElements_global = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_nElements_global == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
9003  __pyx_v_nElementBoundaries_element = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_nElementBoundaries_element == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
9004  __pyx_v_elementNeighborsArray = ((PyArrayObject *)values[10]);
9005  __pyx_v_elementBarycentersArray = ((PyArrayObject *)values[11]);
9006  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[12]);
9007  __pyx_v_nDOF_trial_element = __Pyx_PyInt_As_int(values[13]); if (unlikely((__pyx_v_nDOF_trial_element == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
9008  __pyx_v_u_l2g = ((PyArrayObject *)values[14]);
9009  __pyx_v_u_dof = ((PyArrayObject *)values[15]);
9010  __pyx_v_q_x = ((PyArrayObject *)values[16]);
9011  __pyx_v_q_u = ((PyArrayObject *)values[17]);
9012  __pyx_v_q_mass = ((PyArrayObject *)values[18]);
9013  __pyx_v_q_dmass = ((PyArrayObject *)values[19]);
9014  __pyx_v_q_r = ((PyArrayObject *)values[20]);
9015  __pyx_v_q_kr = ((PyArrayObject *)values[21]);
9016  __pyx_v_q_dkr = ((PyArrayObject *)values[22]);
9017  __pyx_v_q_kr_up = ((PyArrayObject *)values[23]);
9018  }
9019  goto __pyx_L4_argument_unpacking_done;
9020  __pyx_L5_argtuple_error:;
9021  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
9022  __pyx_L3_error:;
9023  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_evaluateElementCoefficients_VGM", __pyx_clineno, __pyx_lineno, __pyx_filename);
9024  __Pyx_RefNannyFinishContext();
9025  return NULL;
9026  __pyx_L4_argument_unpacking_done:;
9027  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gravity), __pyx_ptype_5numpy_ndarray, 1, "gravity", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9028  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_alpha), __pyx_ptype_5numpy_ndarray, 1, "alpha", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9029  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_n), __pyx_ptype_5numpy_ndarray, 1, "n", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9030  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_thetaR), __pyx_ptype_5numpy_ndarray, 1, "thetaR", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9031  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_thetaSR), __pyx_ptype_5numpy_ndarray, 1, "thetaSR", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9032  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementNeighborsArray), __pyx_ptype_5numpy_ndarray, 1, "elementNeighborsArray", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9033  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_ptype_5numpy_ndarray, 1, "elementBarycentersArray", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9034  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9035  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_u_l2g), __pyx_ptype_5numpy_ndarray, 1, "u_l2g", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9036  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_u_dof), __pyx_ptype_5numpy_ndarray, 1, "u_dof", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9037  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_x), __pyx_ptype_5numpy_ndarray, 1, "q_x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9038  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_u), __pyx_ptype_5numpy_ndarray, 1, "q_u", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9039  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_mass), __pyx_ptype_5numpy_ndarray, 1, "q_mass", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9040  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dmass), __pyx_ptype_5numpy_ndarray, 1, "q_dmass", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9041  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_r), __pyx_ptype_5numpy_ndarray, 1, "q_r", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9042  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr), __pyx_ptype_5numpy_ndarray, 1, "q_kr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9043  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dkr), __pyx_ptype_5numpy_ndarray, 1, "q_dkr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9044  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr_up), __pyx_ptype_5numpy_ndarray, 1, "q_kr_up", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9045  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_30RE_NCP1_evaluateElementCoefficients_VGM(__pyx_self, __pyx_v_rho, __pyx_v_beta, __pyx_v_gravity, __pyx_v_alpha, __pyx_v_n, __pyx_v_thetaR, __pyx_v_thetaSR, __pyx_v_nSpace, __pyx_v_nElements_global, __pyx_v_nElementBoundaries_element, __pyx_v_elementNeighborsArray, __pyx_v_elementBarycentersArray, __pyx_v_elementMaterialTypes, __pyx_v_nDOF_trial_element, __pyx_v_u_l2g, __pyx_v_u_dof, __pyx_v_q_x, __pyx_v_q_u, __pyx_v_q_mass, __pyx_v_q_dmass, __pyx_v_q_r, __pyx_v_q_kr, __pyx_v_q_dkr, __pyx_v_q_kr_up);
9046 
9047  /* function exit code */
9048  goto __pyx_L0;
9049  __pyx_L1_error:;
9050  __pyx_r = NULL;
9051  __pyx_L0:;
9052  __Pyx_RefNannyFinishContext();
9053  return __pyx_r;
9054 }
9055 
9056 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_30RE_NCP1_evaluateElementCoefficients_VGM(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_rho, double __pyx_v_beta, PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_alpha, PyArrayObject *__pyx_v_n, PyArrayObject *__pyx_v_thetaR, PyArrayObject *__pyx_v_thetaSR, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, PyArrayObject *__pyx_v_elementNeighborsArray, PyArrayObject *__pyx_v_elementBarycentersArray, PyArrayObject *__pyx_v_elementMaterialTypes, int __pyx_v_nDOF_trial_element, PyArrayObject *__pyx_v_u_l2g, PyArrayObject *__pyx_v_u_dof, CYTHON_UNUSED PyArrayObject *__pyx_v_q_x, PyArrayObject *__pyx_v_q_u, PyArrayObject *__pyx_v_q_mass, PyArrayObject *__pyx_v_q_dmass, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, PyArrayObject *__pyx_v_q_dkr, PyArrayObject *__pyx_v_q_kr_up) {
9057  PyObject *__pyx_v_q = NULL;
9058  double __pyx_v_psiC;
9059  double __pyx_v_pcBar;
9060  double __pyx_v_pcBar_n;
9061  double __pyx_v_pcBar_nM1;
9062  double __pyx_v_pcBar_nM2;
9063  double __pyx_v_onePlus_pcBar_n;
9064  double __pyx_v_sBar;
9065  double __pyx_v_sqrt_sBar;
9066  double __pyx_v_DsBar_DpsiC;
9067  double __pyx_v_thetaW;
9068  double __pyx_v_DthetaW_DpsiC;
9069  double __pyx_v_vBar;
9070  double __pyx_v_vBar2;
9071  double __pyx_v_DvBar_DpsiC;
9072  double __pyx_v_KWr;
9073  double __pyx_v_DKWr_DpsiC;
9074  CYTHON_UNUSED double __pyx_v_rho2;
9075  double __pyx_v_thetaS;
9076  double __pyx_v_rhom;
9077  double __pyx_v_drhom;
9078  double __pyx_v_m;
9079  double __pyx_v_u_j;
9080  double __pyx_v_u_eN;
9081  double __pyx_v_u_neig;
9082  double __pyx_v_kr_eN;
9083  double __pyx_v_kr_neig;
9084  double __pyx_v_phi_eN;
9085  double __pyx_v_phi_neig;
9086  int __pyx_v_eN;
9087  int __pyx_v_eN_neighbor;
9088  int __pyx_v_ebN;
9089  int __pyx_v_j;
9090  int __pyx_v_matID;
9091  double __pyx_v_nAvgWeight;
9092  __Pyx_LocalBuf_ND __pyx_pybuffernd_alpha;
9093  __Pyx_Buffer __pyx_pybuffer_alpha;
9094  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBarycentersArray;
9095  __Pyx_Buffer __pyx_pybuffer_elementBarycentersArray;
9096  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
9097  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
9098  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementNeighborsArray;
9099  __Pyx_Buffer __pyx_pybuffer_elementNeighborsArray;
9100  __Pyx_LocalBuf_ND __pyx_pybuffernd_gravity;
9101  __Pyx_Buffer __pyx_pybuffer_gravity;
9102  __Pyx_LocalBuf_ND __pyx_pybuffernd_n;
9103  __Pyx_Buffer __pyx_pybuffer_n;
9104  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dkr;
9105  __Pyx_Buffer __pyx_pybuffer_q_dkr;
9106  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dmass;
9107  __Pyx_Buffer __pyx_pybuffer_q_dmass;
9108  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr;
9109  __Pyx_Buffer __pyx_pybuffer_q_kr;
9110  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr_up;
9111  __Pyx_Buffer __pyx_pybuffer_q_kr_up;
9112  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_mass;
9113  __Pyx_Buffer __pyx_pybuffer_q_mass;
9114  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_r;
9115  __Pyx_Buffer __pyx_pybuffer_q_r;
9116  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_u;
9117  __Pyx_Buffer __pyx_pybuffer_q_u;
9118  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_x;
9119  __Pyx_Buffer __pyx_pybuffer_q_x;
9120  __Pyx_LocalBuf_ND __pyx_pybuffernd_thetaR;
9121  __Pyx_Buffer __pyx_pybuffer_thetaR;
9122  __Pyx_LocalBuf_ND __pyx_pybuffernd_thetaSR;
9123  __Pyx_Buffer __pyx_pybuffer_thetaSR;
9124  __Pyx_LocalBuf_ND __pyx_pybuffernd_u_dof;
9125  __Pyx_Buffer __pyx_pybuffer_u_dof;
9126  __Pyx_LocalBuf_ND __pyx_pybuffernd_u_l2g;
9127  __Pyx_Buffer __pyx_pybuffer_u_l2g;
9128  PyObject *__pyx_r = NULL;
9129  __Pyx_RefNannyDeclarations
9130  PyObject *__pyx_t_1 = NULL;
9131  PyObject *__pyx_t_2 = NULL;
9132  Py_ssize_t __pyx_t_3;
9133  PyObject *__pyx_t_4 = NULL;
9134  PyObject *__pyx_t_5 = NULL;
9135  int __pyx_t_6;
9136  double __pyx_t_7;
9137  int __pyx_t_8;
9138  int __pyx_t_9;
9139  Py_ssize_t __pyx_t_10;
9140  int __pyx_t_11;
9141  int __pyx_t_12;
9142  Py_ssize_t __pyx_t_13;
9143  Py_ssize_t __pyx_t_14;
9144  int __pyx_t_15;
9145  Py_ssize_t __pyx_t_16;
9146  Py_ssize_t __pyx_t_17;
9147  Py_ssize_t __pyx_t_18;
9148  Py_ssize_t __pyx_t_19;
9149  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_20;
9150  Py_ssize_t __pyx_t_21;
9151  Py_ssize_t __pyx_t_22;
9152  Py_ssize_t __pyx_t_23;
9153  Py_ssize_t __pyx_t_24;
9154  Py_ssize_t __pyx_t_25;
9155  Py_ssize_t __pyx_t_26;
9156  Py_ssize_t __pyx_t_27;
9157  Py_ssize_t __pyx_t_28;
9158  Py_ssize_t __pyx_t_29;
9159  Py_ssize_t __pyx_t_30;
9160  Py_ssize_t __pyx_t_31;
9161  Py_ssize_t __pyx_t_32;
9162  Py_ssize_t __pyx_t_33;
9163  Py_ssize_t __pyx_t_34;
9164  Py_ssize_t __pyx_t_35;
9165  Py_ssize_t __pyx_t_36;
9166  Py_ssize_t __pyx_t_37;
9167  Py_ssize_t __pyx_t_38;
9168  Py_ssize_t __pyx_t_39;
9169  PyObject *__pyx_t_40 = NULL;
9170  PyObject *__pyx_t_41 = NULL;
9171  Py_ssize_t __pyx_t_42;
9172  Py_ssize_t __pyx_t_43;
9173  Py_ssize_t __pyx_t_44;
9174  Py_ssize_t __pyx_t_45;
9175  Py_ssize_t __pyx_t_46;
9176  Py_ssize_t __pyx_t_47;
9177  int __pyx_lineno = 0;
9178  const char *__pyx_filename = NULL;
9179  int __pyx_clineno = 0;
9180  __Pyx_RefNannySetupContext("RE_NCP1_evaluateElementCoefficients_VGM", 0);
9181  __pyx_pybuffer_gravity.pybuffer.buf = NULL;
9182  __pyx_pybuffer_gravity.refcount = 0;
9183  __pyx_pybuffernd_gravity.data = NULL;
9184  __pyx_pybuffernd_gravity.rcbuffer = &__pyx_pybuffer_gravity;
9185  __pyx_pybuffer_alpha.pybuffer.buf = NULL;
9186  __pyx_pybuffer_alpha.refcount = 0;
9187  __pyx_pybuffernd_alpha.data = NULL;
9188  __pyx_pybuffernd_alpha.rcbuffer = &__pyx_pybuffer_alpha;
9189  __pyx_pybuffer_n.pybuffer.buf = NULL;
9190  __pyx_pybuffer_n.refcount = 0;
9191  __pyx_pybuffernd_n.data = NULL;
9192  __pyx_pybuffernd_n.rcbuffer = &__pyx_pybuffer_n;
9193  __pyx_pybuffer_thetaR.pybuffer.buf = NULL;
9194  __pyx_pybuffer_thetaR.refcount = 0;
9195  __pyx_pybuffernd_thetaR.data = NULL;
9196  __pyx_pybuffernd_thetaR.rcbuffer = &__pyx_pybuffer_thetaR;
9197  __pyx_pybuffer_thetaSR.pybuffer.buf = NULL;
9198  __pyx_pybuffer_thetaSR.refcount = 0;
9199  __pyx_pybuffernd_thetaSR.data = NULL;
9200  __pyx_pybuffernd_thetaSR.rcbuffer = &__pyx_pybuffer_thetaSR;
9201  __pyx_pybuffer_elementNeighborsArray.pybuffer.buf = NULL;
9202  __pyx_pybuffer_elementNeighborsArray.refcount = 0;
9203  __pyx_pybuffernd_elementNeighborsArray.data = NULL;
9204  __pyx_pybuffernd_elementNeighborsArray.rcbuffer = &__pyx_pybuffer_elementNeighborsArray;
9205  __pyx_pybuffer_elementBarycentersArray.pybuffer.buf = NULL;
9206  __pyx_pybuffer_elementBarycentersArray.refcount = 0;
9207  __pyx_pybuffernd_elementBarycentersArray.data = NULL;
9208  __pyx_pybuffernd_elementBarycentersArray.rcbuffer = &__pyx_pybuffer_elementBarycentersArray;
9209  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
9210  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
9211  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
9212  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
9213  __pyx_pybuffer_u_l2g.pybuffer.buf = NULL;
9214  __pyx_pybuffer_u_l2g.refcount = 0;
9215  __pyx_pybuffernd_u_l2g.data = NULL;
9216  __pyx_pybuffernd_u_l2g.rcbuffer = &__pyx_pybuffer_u_l2g;
9217  __pyx_pybuffer_u_dof.pybuffer.buf = NULL;
9218  __pyx_pybuffer_u_dof.refcount = 0;
9219  __pyx_pybuffernd_u_dof.data = NULL;
9220  __pyx_pybuffernd_u_dof.rcbuffer = &__pyx_pybuffer_u_dof;
9221  __pyx_pybuffer_q_x.pybuffer.buf = NULL;
9222  __pyx_pybuffer_q_x.refcount = 0;
9223  __pyx_pybuffernd_q_x.data = NULL;
9224  __pyx_pybuffernd_q_x.rcbuffer = &__pyx_pybuffer_q_x;
9225  __pyx_pybuffer_q_u.pybuffer.buf = NULL;
9226  __pyx_pybuffer_q_u.refcount = 0;
9227  __pyx_pybuffernd_q_u.data = NULL;
9228  __pyx_pybuffernd_q_u.rcbuffer = &__pyx_pybuffer_q_u;
9229  __pyx_pybuffer_q_mass.pybuffer.buf = NULL;
9230  __pyx_pybuffer_q_mass.refcount = 0;
9231  __pyx_pybuffernd_q_mass.data = NULL;
9232  __pyx_pybuffernd_q_mass.rcbuffer = &__pyx_pybuffer_q_mass;
9233  __pyx_pybuffer_q_dmass.pybuffer.buf = NULL;
9234  __pyx_pybuffer_q_dmass.refcount = 0;
9235  __pyx_pybuffernd_q_dmass.data = NULL;
9236  __pyx_pybuffernd_q_dmass.rcbuffer = &__pyx_pybuffer_q_dmass;
9237  __pyx_pybuffer_q_r.pybuffer.buf = NULL;
9238  __pyx_pybuffer_q_r.refcount = 0;
9239  __pyx_pybuffernd_q_r.data = NULL;
9240  __pyx_pybuffernd_q_r.rcbuffer = &__pyx_pybuffer_q_r;
9241  __pyx_pybuffer_q_kr.pybuffer.buf = NULL;
9242  __pyx_pybuffer_q_kr.refcount = 0;
9243  __pyx_pybuffernd_q_kr.data = NULL;
9244  __pyx_pybuffernd_q_kr.rcbuffer = &__pyx_pybuffer_q_kr;
9245  __pyx_pybuffer_q_dkr.pybuffer.buf = NULL;
9246  __pyx_pybuffer_q_dkr.refcount = 0;
9247  __pyx_pybuffernd_q_dkr.data = NULL;
9248  __pyx_pybuffernd_q_dkr.rcbuffer = &__pyx_pybuffer_q_dkr;
9249  __pyx_pybuffer_q_kr_up.pybuffer.buf = NULL;
9250  __pyx_pybuffer_q_kr_up.refcount = 0;
9251  __pyx_pybuffernd_q_kr_up.data = NULL;
9252  __pyx_pybuffernd_q_kr_up.rcbuffer = &__pyx_pybuffer_q_kr_up;
9253  {
9254  __Pyx_BufFmt_StackElem __pyx_stack[1];
9255  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer, (PyObject*)__pyx_v_gravity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9256  }
9257  __pyx_pybuffernd_gravity.diminfo[0].strides = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_gravity.diminfo[0].shape = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.shape[0];
9258  {
9259  __Pyx_BufFmt_StackElem __pyx_stack[1];
9260  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_alpha.rcbuffer->pybuffer, (PyObject*)__pyx_v_alpha, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9261  }
9262  __pyx_pybuffernd_alpha.diminfo[0].strides = __pyx_pybuffernd_alpha.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_alpha.diminfo[0].shape = __pyx_pybuffernd_alpha.rcbuffer->pybuffer.shape[0];
9263  {
9264  __Pyx_BufFmt_StackElem __pyx_stack[1];
9265  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_n.rcbuffer->pybuffer, (PyObject*)__pyx_v_n, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9266  }
9267  __pyx_pybuffernd_n.diminfo[0].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_n.diminfo[0].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[0];
9268  {
9269  __Pyx_BufFmt_StackElem __pyx_stack[1];
9270  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_thetaR.rcbuffer->pybuffer, (PyObject*)__pyx_v_thetaR, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9271  }
9272  __pyx_pybuffernd_thetaR.diminfo[0].strides = __pyx_pybuffernd_thetaR.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_thetaR.diminfo[0].shape = __pyx_pybuffernd_thetaR.rcbuffer->pybuffer.shape[0];
9273  {
9274  __Pyx_BufFmt_StackElem __pyx_stack[1];
9275  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_thetaSR.rcbuffer->pybuffer, (PyObject*)__pyx_v_thetaSR, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9276  }
9277  __pyx_pybuffernd_thetaSR.diminfo[0].strides = __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_thetaSR.diminfo[0].shape = __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.shape[0];
9278  {
9279  __Pyx_BufFmt_StackElem __pyx_stack[1];
9280  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementNeighborsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9281  }
9282  __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[1];
9283  {
9284  __Pyx_BufFmt_StackElem __pyx_stack[1];
9285  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBarycentersArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9286  }
9287  __pyx_pybuffernd_elementBarycentersArray.diminfo[0].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[0].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[1];
9288  {
9289  __Pyx_BufFmt_StackElem __pyx_stack[1];
9290  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9291  }
9292  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
9293  {
9294  __Pyx_BufFmt_StackElem __pyx_stack[1];
9295  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_u_l2g.rcbuffer->pybuffer, (PyObject*)__pyx_v_u_l2g, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9296  }
9297  __pyx_pybuffernd_u_l2g.diminfo[0].strides = __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_u_l2g.diminfo[0].shape = __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_u_l2g.diminfo[1].strides = __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_u_l2g.diminfo[1].shape = __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.shape[1];
9298  {
9299  __Pyx_BufFmt_StackElem __pyx_stack[1];
9300  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_u_dof.rcbuffer->pybuffer, (PyObject*)__pyx_v_u_dof, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9301  }
9302  __pyx_pybuffernd_u_dof.diminfo[0].strides = __pyx_pybuffernd_u_dof.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_u_dof.diminfo[0].shape = __pyx_pybuffernd_u_dof.rcbuffer->pybuffer.shape[0];
9303  {
9304  __Pyx_BufFmt_StackElem __pyx_stack[1];
9305  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9306  }
9307  __pyx_pybuffernd_q_x.diminfo[0].strides = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_x.diminfo[0].shape = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_x.diminfo[1].strides = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_x.diminfo[1].shape = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_x.diminfo[2].strides = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_x.diminfo[2].shape = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.shape[2];
9308  {
9309  __Pyx_BufFmt_StackElem __pyx_stack[1];
9310  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9311  }
9312  __pyx_pybuffernd_q_u.diminfo[0].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_u.diminfo[0].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_u.diminfo[1].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_u.diminfo[1].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[1];
9313  {
9314  __Pyx_BufFmt_StackElem __pyx_stack[1];
9315  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_mass.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_mass, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9316  }
9317  __pyx_pybuffernd_q_mass.diminfo[0].strides = __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_mass.diminfo[0].shape = __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_mass.diminfo[1].strides = __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_mass.diminfo[1].shape = __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.shape[1];
9318  {
9319  __Pyx_BufFmt_StackElem __pyx_stack[1];
9320  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dmass.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dmass, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9321  }
9322  __pyx_pybuffernd_q_dmass.diminfo[0].strides = __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dmass.diminfo[0].shape = __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dmass.diminfo[1].strides = __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dmass.diminfo[1].shape = __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.shape[1];
9323  {
9324  __Pyx_BufFmt_StackElem __pyx_stack[1];
9325  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_r, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9326  }
9327  __pyx_pybuffernd_q_r.diminfo[0].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_r.diminfo[0].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_r.diminfo[1].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_r.diminfo[1].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[1];
9328  {
9329  __Pyx_BufFmt_StackElem __pyx_stack[1];
9330  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9331  }
9332  __pyx_pybuffernd_q_kr.diminfo[0].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr.diminfo[0].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr.diminfo[1].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr.diminfo[1].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[1];
9333  {
9334  __Pyx_BufFmt_StackElem __pyx_stack[1];
9335  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dkr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9336  }
9337  __pyx_pybuffernd_q_dkr.diminfo[0].strides = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dkr.diminfo[0].shape = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dkr.diminfo[1].strides = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dkr.diminfo[1].shape = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.shape[1];
9338  {
9339  __Pyx_BufFmt_StackElem __pyx_stack[1];
9340  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr_up, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9341  }
9342  __pyx_pybuffernd_q_kr_up.diminfo[0].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr_up.diminfo[0].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr_up.diminfo[1].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr_up.diminfo[1].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[1];
9343 
9344  /* "subsurfaceTransportFunctions.pyx":399
9345  * """
9346  * #check some sizes
9347  * for q in [q_u,q_mass,q_r,q_kr,q_dkr]: # <<<<<<<<<<<<<<
9348  * assert q.shape[1] == nSpace+1
9349  * assert nDOF_trial_element == nSpace + 1
9350  */
9351  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9352  __Pyx_GOTREF(__pyx_t_1);
9353  __Pyx_INCREF(((PyObject *)__pyx_v_q_u));
9354  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_u));
9355  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_q_u));
9356  __Pyx_INCREF(((PyObject *)__pyx_v_q_mass));
9357  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_mass));
9358  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_q_mass));
9359  __Pyx_INCREF(((PyObject *)__pyx_v_q_r));
9360  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_r));
9361  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_q_r));
9362  __Pyx_INCREF(((PyObject *)__pyx_v_q_kr));
9363  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_kr));
9364  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_q_kr));
9365  __Pyx_INCREF(((PyObject *)__pyx_v_q_dkr));
9366  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_dkr));
9367  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_q_dkr));
9368  __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
9369  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9370  for (;;) {
9371  if (__pyx_t_3 >= 5) break;
9372  #if CYTHON_COMPILING_IN_CPYTHON
9373  __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9374  #else
9375  __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9376  __Pyx_GOTREF(__pyx_t_1);
9377  #endif
9378  __Pyx_XDECREF_SET(__pyx_v_q, __pyx_t_1);
9379  __pyx_t_1 = 0;
9380 
9381  /* "subsurfaceTransportFunctions.pyx":400
9382  * #check some sizes
9383  * for q in [q_u,q_mass,q_r,q_kr,q_dkr]:
9384  * assert q.shape[1] == nSpace+1 # <<<<<<<<<<<<<<
9385  * assert nDOF_trial_element == nSpace + 1
9386  * #temporaries
9387  */
9388  #ifndef CYTHON_WITHOUT_ASSERTIONS
9389  if (unlikely(!Py_OptimizeFlag)) {
9390  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_q, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9391  __Pyx_GOTREF(__pyx_t_1);
9392  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
9393  __Pyx_GOTREF(__pyx_t_4);
9394  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9395  __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_nSpace + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9396  __Pyx_GOTREF(__pyx_t_1);
9397  __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9398  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9399  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9400  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9401  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9402  if (unlikely(!__pyx_t_6)) {
9403  PyErr_SetNone(PyExc_AssertionError);
9404  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9405  }
9406  }
9407  #endif
9408 
9409  /* "subsurfaceTransportFunctions.pyx":399
9410  * """
9411  * #check some sizes
9412  * for q in [q_u,q_mass,q_r,q_kr,q_dkr]: # <<<<<<<<<<<<<<
9413  * assert q.shape[1] == nSpace+1
9414  * assert nDOF_trial_element == nSpace + 1
9415  */
9416  }
9417  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9418 
9419  /* "subsurfaceTransportFunctions.pyx":401
9420  * for q in [q_u,q_mass,q_r,q_kr,q_dkr]:
9421  * assert q.shape[1] == nSpace+1
9422  * assert nDOF_trial_element == nSpace + 1 # <<<<<<<<<<<<<<
9423  * #temporaries
9424  * cdef double psiC,pcBar,pcBar_n,pcBar_nM1,pcBar_nM2,onePlus_pcBar_n,sBar,sqrt_sBar,DsBar_DpsiC,thetaW,DthetaW_DpsiC
9425  */
9426  #ifndef CYTHON_WITHOUT_ASSERTIONS
9427  if (unlikely(!Py_OptimizeFlag)) {
9428  if (unlikely(!((__pyx_v_nDOF_trial_element == (__pyx_v_nSpace + 1)) != 0))) {
9429  PyErr_SetNone(PyExc_AssertionError);
9430  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9431  }
9432  }
9433  #endif
9434 
9435  /* "subsurfaceTransportFunctions.pyx":404
9436  * #temporaries
9437  * cdef double psiC,pcBar,pcBar_n,pcBar_nM1,pcBar_nM2,onePlus_pcBar_n,sBar,sqrt_sBar,DsBar_DpsiC,thetaW,DthetaW_DpsiC
9438  * cdef double vBar,vBar2,DvBar_DpsiC,KWr,DKWr_DpsiC,rho2=rho*rho,thetaS,rhom,drhom,m # <<<<<<<<<<<<<<
9439  *
9440  * cdef double u_j,u_eN,u_neig,kr_eN,kr_neig,phi_eN,phi_neig
9441  */
9442  __pyx_v_rho2 = (__pyx_v_rho * __pyx_v_rho);
9443 
9444  /* "subsurfaceTransportFunctions.pyx":409
9445  * cdef int eN,eN_neighbor,ebN,ii,I,j,matID
9446  * #for averaging/integration weights
9447  * cdef double nAvgWeight = 1.0/(nSpace+1.) # <<<<<<<<<<<<<<
9448  *
9449  * #loop through and evaluate
9450  */
9451  __pyx_t_7 = (__pyx_v_nSpace + 1.);
9452  if (unlikely(__pyx_t_7 == 0)) {
9453  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
9454  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9455  }
9456  __pyx_v_nAvgWeight = (1.0 / __pyx_t_7);
9457 
9458  /* "subsurfaceTransportFunctions.pyx":412
9459  *
9460  * #loop through and evaluate
9461  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
9462  * matID = elementMaterialTypes[eN]
9463  * for j in range(nDOF_trial_element):
9464  */
9465  __pyx_t_8 = __pyx_v_nElements_global;
9466  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
9467  __pyx_v_eN = __pyx_t_9;
9468 
9469  /* "subsurfaceTransportFunctions.pyx":413
9470  * #loop through and evaluate
9471  * for eN in range(nElements_global):
9472  * matID = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
9473  * for j in range(nDOF_trial_element):
9474  * u_j = u_dof[u_l2g[eN,j]]
9475  */
9476  __pyx_t_10 = __pyx_v_eN;
9477  __pyx_t_11 = -1;
9478  if (__pyx_t_10 < 0) {
9479  __pyx_t_10 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
9480  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
9481  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_11 = 0;
9482  if (unlikely(__pyx_t_11 != -1)) {
9483  __Pyx_RaiseBufferIndexError(__pyx_t_11);
9484  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9485  }
9486  __pyx_v_matID = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
9487 
9488  /* "subsurfaceTransportFunctions.pyx":414
9489  * for eN in range(nElements_global):
9490  * matID = elementMaterialTypes[eN]
9491  * for j in range(nDOF_trial_element): # <<<<<<<<<<<<<<
9492  * u_j = u_dof[u_l2g[eN,j]]
9493  * q_u[eN,j] = u_j
9494  */
9495  __pyx_t_11 = __pyx_v_nDOF_trial_element;
9496  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
9497  __pyx_v_j = __pyx_t_12;
9498 
9499  /* "subsurfaceTransportFunctions.pyx":415
9500  * matID = elementMaterialTypes[eN]
9501  * for j in range(nDOF_trial_element):
9502  * u_j = u_dof[u_l2g[eN,j]] # <<<<<<<<<<<<<<
9503  * q_u[eN,j] = u_j
9504  *
9505  */
9506  __pyx_t_13 = __pyx_v_eN;
9507  __pyx_t_14 = __pyx_v_j;
9508  __pyx_t_15 = -1;
9509  if (__pyx_t_13 < 0) {
9510  __pyx_t_13 += __pyx_pybuffernd_u_l2g.diminfo[0].shape;
9511  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 0;
9512  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_u_l2g.diminfo[0].shape)) __pyx_t_15 = 0;
9513  if (__pyx_t_14 < 0) {
9514  __pyx_t_14 += __pyx_pybuffernd_u_l2g.diminfo[1].shape;
9515  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 1;
9516  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_u_l2g.diminfo[1].shape)) __pyx_t_15 = 1;
9517  if (unlikely(__pyx_t_15 != -1)) {
9518  __Pyx_RaiseBufferIndexError(__pyx_t_15);
9519  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9520  }
9521  __pyx_t_16 = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_u_l2g.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_u_l2g.diminfo[1].strides));
9522  __pyx_t_15 = -1;
9523  if (__pyx_t_16 < 0) {
9524  __pyx_t_16 += __pyx_pybuffernd_u_dof.diminfo[0].shape;
9525  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 0;
9526  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_u_dof.diminfo[0].shape)) __pyx_t_15 = 0;
9527  if (unlikely(__pyx_t_15 != -1)) {
9528  __Pyx_RaiseBufferIndexError(__pyx_t_15);
9529  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9530  }
9531  __pyx_v_u_j = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_u_dof.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_u_dof.diminfo[0].strides));
9532 
9533  /* "subsurfaceTransportFunctions.pyx":416
9534  * for j in range(nDOF_trial_element):
9535  * u_j = u_dof[u_l2g[eN,j]]
9536  * q_u[eN,j] = u_j # <<<<<<<<<<<<<<
9537  *
9538  * #VGM evaluation
9539  */
9540  __pyx_t_17 = __pyx_v_eN;
9541  __pyx_t_18 = __pyx_v_j;
9542  __pyx_t_15 = -1;
9543  if (__pyx_t_17 < 0) {
9544  __pyx_t_17 += __pyx_pybuffernd_q_u.diminfo[0].shape;
9545  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 0;
9546  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_q_u.diminfo[0].shape)) __pyx_t_15 = 0;
9547  if (__pyx_t_18 < 0) {
9548  __pyx_t_18 += __pyx_pybuffernd_q_u.diminfo[1].shape;
9549  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 1;
9550  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_q_u.diminfo[1].shape)) __pyx_t_15 = 1;
9551  if (unlikely(__pyx_t_15 != -1)) {
9552  __Pyx_RaiseBufferIndexError(__pyx_t_15);
9553  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9554  }
9555  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_u.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_q_u.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_q_u.diminfo[1].strides) = __pyx_v_u_j;
9556 
9557  /* "subsurfaceTransportFunctions.pyx":419
9558  *
9559  * #VGM evaluation
9560  * psiC = -u_j # <<<<<<<<<<<<<<
9561  * m = 1.0 - 1.0/n[matID]
9562  * thetaS = thetaR[matID] + thetaSR[matID]
9563  */
9564  __pyx_v_psiC = (-__pyx_v_u_j);
9565 
9566  /* "subsurfaceTransportFunctions.pyx":420
9567  * #VGM evaluation
9568  * psiC = -u_j
9569  * m = 1.0 - 1.0/n[matID] # <<<<<<<<<<<<<<
9570  * thetaS = thetaR[matID] + thetaSR[matID]
9571  * if psiC > 0.0:
9572  */
9573  __pyx_t_19 = __pyx_v_matID;
9574  __pyx_t_15 = -1;
9575  if (__pyx_t_19 < 0) {
9576  __pyx_t_19 += __pyx_pybuffernd_n.diminfo[0].shape;
9577  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 0;
9578  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_15 = 0;
9579  if (unlikely(__pyx_t_15 != -1)) {
9580  __Pyx_RaiseBufferIndexError(__pyx_t_15);
9581  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9582  }
9583  __pyx_t_20 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_n.diminfo[0].strides));
9584  if (unlikely(__pyx_t_20 == 0)) {
9585  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
9586  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9587  }
9588  __pyx_v_m = (1.0 - (1.0 / __pyx_t_20));
9589 
9590  /* "subsurfaceTransportFunctions.pyx":421
9591  * psiC = -u_j
9592  * m = 1.0 - 1.0/n[matID]
9593  * thetaS = thetaR[matID] + thetaSR[matID] # <<<<<<<<<<<<<<
9594  * if psiC > 0.0:
9595  * pcBar = alpha[matID]*psiC
9596  */
9597  __pyx_t_21 = __pyx_v_matID;
9598  __pyx_t_15 = -1;
9599  if (__pyx_t_21 < 0) {
9600  __pyx_t_21 += __pyx_pybuffernd_thetaR.diminfo[0].shape;
9601  if (unlikely(__pyx_t_21 < 0)) __pyx_t_15 = 0;
9602  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_thetaR.diminfo[0].shape)) __pyx_t_15 = 0;
9603  if (unlikely(__pyx_t_15 != -1)) {
9604  __Pyx_RaiseBufferIndexError(__pyx_t_15);
9605  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9606  }
9607  __pyx_t_22 = __pyx_v_matID;
9608  __pyx_t_15 = -1;
9609  if (__pyx_t_22 < 0) {
9610  __pyx_t_22 += __pyx_pybuffernd_thetaSR.diminfo[0].shape;
9611  if (unlikely(__pyx_t_22 < 0)) __pyx_t_15 = 0;
9612  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_thetaSR.diminfo[0].shape)) __pyx_t_15 = 0;
9613  if (unlikely(__pyx_t_15 != -1)) {
9614  __Pyx_RaiseBufferIndexError(__pyx_t_15);
9615  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9616  }
9617  __pyx_v_thetaS = ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaR.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_thetaR.diminfo[0].strides)) + (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_thetaSR.diminfo[0].strides)));
9618 
9619  /* "subsurfaceTransportFunctions.pyx":422
9620  * m = 1.0 - 1.0/n[matID]
9621  * thetaS = thetaR[matID] + thetaSR[matID]
9622  * if psiC > 0.0: # <<<<<<<<<<<<<<
9623  * pcBar = alpha[matID]*psiC
9624  * pcBar_nM2 = pow(pcBar,n[matID]-2)
9625  */
9626  __pyx_t_6 = ((__pyx_v_psiC > 0.0) != 0);
9627  if (__pyx_t_6) {
9628 
9629  /* "subsurfaceTransportFunctions.pyx":423
9630  * thetaS = thetaR[matID] + thetaSR[matID]
9631  * if psiC > 0.0:
9632  * pcBar = alpha[matID]*psiC # <<<<<<<<<<<<<<
9633  * pcBar_nM2 = pow(pcBar,n[matID]-2)
9634  * pcBar_nM1 = pcBar_nM2*pcBar
9635  */
9636  __pyx_t_23 = __pyx_v_matID;
9637  __pyx_t_15 = -1;
9638  if (__pyx_t_23 < 0) {
9639  __pyx_t_23 += __pyx_pybuffernd_alpha.diminfo[0].shape;
9640  if (unlikely(__pyx_t_23 < 0)) __pyx_t_15 = 0;
9641  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_alpha.diminfo[0].shape)) __pyx_t_15 = 0;
9642  if (unlikely(__pyx_t_15 != -1)) {
9643  __Pyx_RaiseBufferIndexError(__pyx_t_15);
9644  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9645  }
9646  __pyx_v_pcBar = ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_alpha.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_alpha.diminfo[0].strides)) * __pyx_v_psiC);
9647 
9648  /* "subsurfaceTransportFunctions.pyx":424
9649  * if psiC > 0.0:
9650  * pcBar = alpha[matID]*psiC
9651  * pcBar_nM2 = pow(pcBar,n[matID]-2) # <<<<<<<<<<<<<<
9652  * pcBar_nM1 = pcBar_nM2*pcBar
9653  * pcBar_n = pcBar_nM1*pcBar
9654  */
9655  __pyx_t_24 = __pyx_v_matID;
9656  __pyx_t_15 = -1;
9657  if (__pyx_t_24 < 0) {
9658  __pyx_t_24 += __pyx_pybuffernd_n.diminfo[0].shape;
9659  if (unlikely(__pyx_t_24 < 0)) __pyx_t_15 = 0;
9660  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_15 = 0;
9661  if (unlikely(__pyx_t_15 != -1)) {
9662  __Pyx_RaiseBufferIndexError(__pyx_t_15);
9663  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9664  }
9665  __pyx_v_pcBar_nM2 = pow(__pyx_v_pcBar, ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_n.diminfo[0].strides)) - 2.0));
9666 
9667  /* "subsurfaceTransportFunctions.pyx":425
9668  * pcBar = alpha[matID]*psiC
9669  * pcBar_nM2 = pow(pcBar,n[matID]-2)
9670  * pcBar_nM1 = pcBar_nM2*pcBar # <<<<<<<<<<<<<<
9671  * pcBar_n = pcBar_nM1*pcBar
9672  * onePlus_pcBar_n = 1.0 + pcBar_n
9673  */
9674  __pyx_v_pcBar_nM1 = (__pyx_v_pcBar_nM2 * __pyx_v_pcBar);
9675 
9676  /* "subsurfaceTransportFunctions.pyx":426
9677  * pcBar_nM2 = pow(pcBar,n[matID]-2)
9678  * pcBar_nM1 = pcBar_nM2*pcBar
9679  * pcBar_n = pcBar_nM1*pcBar # <<<<<<<<<<<<<<
9680  * onePlus_pcBar_n = 1.0 + pcBar_n
9681  *
9682  */
9683  __pyx_v_pcBar_n = (__pyx_v_pcBar_nM1 * __pyx_v_pcBar);
9684 
9685  /* "subsurfaceTransportFunctions.pyx":427
9686  * pcBar_nM1 = pcBar_nM2*pcBar
9687  * pcBar_n = pcBar_nM1*pcBar
9688  * onePlus_pcBar_n = 1.0 + pcBar_n # <<<<<<<<<<<<<<
9689  *
9690  * sBar = pow(onePlus_pcBar_n,-m)
9691  */
9692  __pyx_v_onePlus_pcBar_n = (1.0 + __pyx_v_pcBar_n);
9693 
9694  /* "subsurfaceTransportFunctions.pyx":429
9695  * onePlus_pcBar_n = 1.0 + pcBar_n
9696  *
9697  * sBar = pow(onePlus_pcBar_n,-m) # <<<<<<<<<<<<<<
9698  * # using -mn = 1-n
9699  * DsBar_DpsiC = alpha[matID]*(1.0-n[matID])*(sBar/onePlus_pcBar_n)*pcBar_nM1
9700  */
9701  __pyx_v_sBar = pow(__pyx_v_onePlus_pcBar_n, (-__pyx_v_m));
9702 
9703  /* "subsurfaceTransportFunctions.pyx":431
9704  * sBar = pow(onePlus_pcBar_n,-m)
9705  * # using -mn = 1-n
9706  * DsBar_DpsiC = alpha[matID]*(1.0-n[matID])*(sBar/onePlus_pcBar_n)*pcBar_nM1 # <<<<<<<<<<<<<<
9707  *
9708  * vBar = 1.0-pcBar_nM1*sBar
9709  */
9710  __pyx_t_25 = __pyx_v_matID;
9711  __pyx_t_15 = -1;
9712  if (__pyx_t_25 < 0) {
9713  __pyx_t_25 += __pyx_pybuffernd_alpha.diminfo[0].shape;
9714  if (unlikely(__pyx_t_25 < 0)) __pyx_t_15 = 0;
9715  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_alpha.diminfo[0].shape)) __pyx_t_15 = 0;
9716  if (unlikely(__pyx_t_15 != -1)) {
9717  __Pyx_RaiseBufferIndexError(__pyx_t_15);
9718  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9719  }
9720  __pyx_t_26 = __pyx_v_matID;
9721  __pyx_t_15 = -1;
9722  if (__pyx_t_26 < 0) {
9723  __pyx_t_26 += __pyx_pybuffernd_n.diminfo[0].shape;
9724  if (unlikely(__pyx_t_26 < 0)) __pyx_t_15 = 0;
9725  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_15 = 0;
9726  if (unlikely(__pyx_t_15 != -1)) {
9727  __Pyx_RaiseBufferIndexError(__pyx_t_15);
9728  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9729  }
9730  if (unlikely(__pyx_v_onePlus_pcBar_n == 0)) {
9731  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
9732  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9733  }
9734  __pyx_v_DsBar_DpsiC = ((((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_alpha.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_alpha.diminfo[0].strides)) * (1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_n.diminfo[0].strides)))) * (__pyx_v_sBar / __pyx_v_onePlus_pcBar_n)) * __pyx_v_pcBar_nM1);
9735 
9736  /* "subsurfaceTransportFunctions.pyx":433
9737  * DsBar_DpsiC = alpha[matID]*(1.0-n[matID])*(sBar/onePlus_pcBar_n)*pcBar_nM1
9738  *
9739  * vBar = 1.0-pcBar_nM1*sBar # <<<<<<<<<<<<<<
9740  * vBar2 = vBar*vBar
9741  * DvBar_DpsiC = -alpha[matID]*(n[matID]-1.0)*pcBar_nM2*sBar - pcBar_nM1*DsBar_DpsiC
9742  */
9743  __pyx_v_vBar = (1.0 - (__pyx_v_pcBar_nM1 * __pyx_v_sBar));
9744 
9745  /* "subsurfaceTransportFunctions.pyx":434
9746  *
9747  * vBar = 1.0-pcBar_nM1*sBar
9748  * vBar2 = vBar*vBar # <<<<<<<<<<<<<<
9749  * DvBar_DpsiC = -alpha[matID]*(n[matID]-1.0)*pcBar_nM2*sBar - pcBar_nM1*DsBar_DpsiC
9750  *
9751  */
9752  __pyx_v_vBar2 = (__pyx_v_vBar * __pyx_v_vBar);
9753 
9754  /* "subsurfaceTransportFunctions.pyx":435
9755  * vBar = 1.0-pcBar_nM1*sBar
9756  * vBar2 = vBar*vBar
9757  * DvBar_DpsiC = -alpha[matID]*(n[matID]-1.0)*pcBar_nM2*sBar - pcBar_nM1*DsBar_DpsiC # <<<<<<<<<<<<<<
9758  *
9759  * thetaW = thetaSR[matID]*sBar + thetaR[matID]
9760  */
9761  __pyx_t_27 = __pyx_v_matID;
9762  __pyx_t_15 = -1;
9763  if (__pyx_t_27 < 0) {
9764  __pyx_t_27 += __pyx_pybuffernd_alpha.diminfo[0].shape;
9765  if (unlikely(__pyx_t_27 < 0)) __pyx_t_15 = 0;
9766  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_alpha.diminfo[0].shape)) __pyx_t_15 = 0;
9767  if (unlikely(__pyx_t_15 != -1)) {
9768  __Pyx_RaiseBufferIndexError(__pyx_t_15);
9769  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9770  }
9771  __pyx_t_28 = __pyx_v_matID;
9772  __pyx_t_15 = -1;
9773  if (__pyx_t_28 < 0) {
9774  __pyx_t_28 += __pyx_pybuffernd_n.diminfo[0].shape;
9775  if (unlikely(__pyx_t_28 < 0)) __pyx_t_15 = 0;
9776  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_15 = 0;
9777  if (unlikely(__pyx_t_15 != -1)) {
9778  __Pyx_RaiseBufferIndexError(__pyx_t_15);
9779  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9780  }
9781  __pyx_v_DvBar_DpsiC = (((((-(*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_alpha.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_alpha.diminfo[0].strides))) * ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_n.diminfo[0].strides)) - 1.0)) * __pyx_v_pcBar_nM2) * __pyx_v_sBar) - (__pyx_v_pcBar_nM1 * __pyx_v_DsBar_DpsiC));
9782 
9783  /* "subsurfaceTransportFunctions.pyx":437
9784  * DvBar_DpsiC = -alpha[matID]*(n[matID]-1.0)*pcBar_nM2*sBar - pcBar_nM1*DsBar_DpsiC
9785  *
9786  * thetaW = thetaSR[matID]*sBar + thetaR[matID] # <<<<<<<<<<<<<<
9787  * DthetaW_DpsiC = thetaSR[matID] * DsBar_DpsiC
9788  *
9789  */
9790  __pyx_t_29 = __pyx_v_matID;
9791  __pyx_t_15 = -1;
9792  if (__pyx_t_29 < 0) {
9793  __pyx_t_29 += __pyx_pybuffernd_thetaSR.diminfo[0].shape;
9794  if (unlikely(__pyx_t_29 < 0)) __pyx_t_15 = 0;
9795  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_thetaSR.diminfo[0].shape)) __pyx_t_15 = 0;
9796  if (unlikely(__pyx_t_15 != -1)) {
9797  __Pyx_RaiseBufferIndexError(__pyx_t_15);
9798  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9799  }
9800  __pyx_t_30 = __pyx_v_matID;
9801  __pyx_t_15 = -1;
9802  if (__pyx_t_30 < 0) {
9803  __pyx_t_30 += __pyx_pybuffernd_thetaR.diminfo[0].shape;
9804  if (unlikely(__pyx_t_30 < 0)) __pyx_t_15 = 0;
9805  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_thetaR.diminfo[0].shape)) __pyx_t_15 = 0;
9806  if (unlikely(__pyx_t_15 != -1)) {
9807  __Pyx_RaiseBufferIndexError(__pyx_t_15);
9808  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9809  }
9810  __pyx_v_thetaW = (((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_thetaSR.diminfo[0].strides)) * __pyx_v_sBar) + (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaR.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_thetaR.diminfo[0].strides)));
9811 
9812  /* "subsurfaceTransportFunctions.pyx":438
9813  *
9814  * thetaW = thetaSR[matID]*sBar + thetaR[matID]
9815  * DthetaW_DpsiC = thetaSR[matID] * DsBar_DpsiC # <<<<<<<<<<<<<<
9816  *
9817  * sqrt_sBar = sqrt(sBar)
9818  */
9819  __pyx_t_31 = __pyx_v_matID;
9820  __pyx_t_15 = -1;
9821  if (__pyx_t_31 < 0) {
9822  __pyx_t_31 += __pyx_pybuffernd_thetaSR.diminfo[0].shape;
9823  if (unlikely(__pyx_t_31 < 0)) __pyx_t_15 = 0;
9824  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_thetaSR.diminfo[0].shape)) __pyx_t_15 = 0;
9825  if (unlikely(__pyx_t_15 != -1)) {
9826  __Pyx_RaiseBufferIndexError(__pyx_t_15);
9827  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9828  }
9829  __pyx_v_DthetaW_DpsiC = ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_thetaSR.diminfo[0].strides)) * __pyx_v_DsBar_DpsiC);
9830 
9831  /* "subsurfaceTransportFunctions.pyx":440
9832  * DthetaW_DpsiC = thetaSR[matID] * DsBar_DpsiC
9833  *
9834  * sqrt_sBar = sqrt(sBar) # <<<<<<<<<<<<<<
9835  * KWr= sqrt_sBar*vBar2
9836  * DKWr_DpsiC= ((0.5/sqrt_sBar)*DsBar_DpsiC*vBar2 + 2.0*sqrt_sBar*vBar*DvBar_DpsiC)
9837  */
9838  __pyx_v_sqrt_sBar = sqrt(__pyx_v_sBar);
9839 
9840  /* "subsurfaceTransportFunctions.pyx":441
9841  *
9842  * sqrt_sBar = sqrt(sBar)
9843  * KWr= sqrt_sBar*vBar2 # <<<<<<<<<<<<<<
9844  * DKWr_DpsiC= ((0.5/sqrt_sBar)*DsBar_DpsiC*vBar2 + 2.0*sqrt_sBar*vBar*DvBar_DpsiC)
9845  * else:
9846  */
9847  __pyx_v_KWr = (__pyx_v_sqrt_sBar * __pyx_v_vBar2);
9848 
9849  /* "subsurfaceTransportFunctions.pyx":442
9850  * sqrt_sBar = sqrt(sBar)
9851  * KWr= sqrt_sBar*vBar2
9852  * DKWr_DpsiC= ((0.5/sqrt_sBar)*DsBar_DpsiC*vBar2 + 2.0*sqrt_sBar*vBar*DvBar_DpsiC) # <<<<<<<<<<<<<<
9853  * else:
9854  * thetaW = thetaS
9855  */
9856  if (unlikely(__pyx_v_sqrt_sBar == 0)) {
9857  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
9858  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9859  }
9860  __pyx_v_DKWr_DpsiC = ((((0.5 / __pyx_v_sqrt_sBar) * __pyx_v_DsBar_DpsiC) * __pyx_v_vBar2) + (((2.0 * __pyx_v_sqrt_sBar) * __pyx_v_vBar) * __pyx_v_DvBar_DpsiC));
9861 
9862  /* "subsurfaceTransportFunctions.pyx":422
9863  * m = 1.0 - 1.0/n[matID]
9864  * thetaS = thetaR[matID] + thetaSR[matID]
9865  * if psiC > 0.0: # <<<<<<<<<<<<<<
9866  * pcBar = alpha[matID]*psiC
9867  * pcBar_nM2 = pow(pcBar,n[matID]-2)
9868  */
9869  goto __pyx_L9;
9870  }
9871 
9872  /* "subsurfaceTransportFunctions.pyx":444
9873  * DKWr_DpsiC= ((0.5/sqrt_sBar)*DsBar_DpsiC*vBar2 + 2.0*sqrt_sBar*vBar*DvBar_DpsiC)
9874  * else:
9875  * thetaW = thetaS # <<<<<<<<<<<<<<
9876  * DthetaW_DpsiC = 0.0
9877  * KWr = 1.0
9878  */
9879  /*else*/ {
9880  __pyx_v_thetaW = __pyx_v_thetaS;
9881 
9882  /* "subsurfaceTransportFunctions.pyx":445
9883  * else:
9884  * thetaW = thetaS
9885  * DthetaW_DpsiC = 0.0 # <<<<<<<<<<<<<<
9886  * KWr = 1.0
9887  * DKWr_DpsiC = 0.0
9888  */
9889  __pyx_v_DthetaW_DpsiC = 0.0;
9890 
9891  /* "subsurfaceTransportFunctions.pyx":446
9892  * thetaW = thetaS
9893  * DthetaW_DpsiC = 0.0
9894  * KWr = 1.0 # <<<<<<<<<<<<<<
9895  * DKWr_DpsiC = 0.0
9896  * #
9897  */
9898  __pyx_v_KWr = 1.0;
9899 
9900  /* "subsurfaceTransportFunctions.pyx":447
9901  * DthetaW_DpsiC = 0.0
9902  * KWr = 1.0
9903  * DKWr_DpsiC = 0.0 # <<<<<<<<<<<<<<
9904  * #
9905  * rhom = rho*exp(beta*u_j)
9906  */
9907  __pyx_v_DKWr_DpsiC = 0.0;
9908  }
9909  __pyx_L9:;
9910 
9911  /* "subsurfaceTransportFunctions.pyx":449
9912  * DKWr_DpsiC = 0.0
9913  * #
9914  * rhom = rho*exp(beta*u_j) # <<<<<<<<<<<<<<
9915  * drhom= beta*rhom
9916  * q_mass[eN,j] = rhom*thetaW
9917  */
9918  __pyx_v_rhom = (__pyx_v_rho * exp((__pyx_v_beta * __pyx_v_u_j)));
9919 
9920  /* "subsurfaceTransportFunctions.pyx":450
9921  * #
9922  * rhom = rho*exp(beta*u_j)
9923  * drhom= beta*rhom # <<<<<<<<<<<<<<
9924  * q_mass[eN,j] = rhom*thetaW
9925  * q_dmass[eN,j]=-rhom*DthetaW_DpsiC+drhom*thetaW
9926  */
9927  __pyx_v_drhom = (__pyx_v_beta * __pyx_v_rhom);
9928 
9929  /* "subsurfaceTransportFunctions.pyx":451
9930  * rhom = rho*exp(beta*u_j)
9931  * drhom= beta*rhom
9932  * q_mass[eN,j] = rhom*thetaW # <<<<<<<<<<<<<<
9933  * q_dmass[eN,j]=-rhom*DthetaW_DpsiC+drhom*thetaW
9934  *
9935  */
9936  __pyx_t_32 = __pyx_v_eN;
9937  __pyx_t_33 = __pyx_v_j;
9938  __pyx_t_15 = -1;
9939  if (__pyx_t_32 < 0) {
9940  __pyx_t_32 += __pyx_pybuffernd_q_mass.diminfo[0].shape;
9941  if (unlikely(__pyx_t_32 < 0)) __pyx_t_15 = 0;
9942  } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_q_mass.diminfo[0].shape)) __pyx_t_15 = 0;
9943  if (__pyx_t_33 < 0) {
9944  __pyx_t_33 += __pyx_pybuffernd_q_mass.diminfo[1].shape;
9945  if (unlikely(__pyx_t_33 < 0)) __pyx_t_15 = 1;
9946  } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_q_mass.diminfo[1].shape)) __pyx_t_15 = 1;
9947  if (unlikely(__pyx_t_15 != -1)) {
9948  __Pyx_RaiseBufferIndexError(__pyx_t_15);
9949  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9950  }
9951  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_q_mass.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_q_mass.diminfo[1].strides) = (__pyx_v_rhom * __pyx_v_thetaW);
9952 
9953  /* "subsurfaceTransportFunctions.pyx":452
9954  * drhom= beta*rhom
9955  * q_mass[eN,j] = rhom*thetaW
9956  * q_dmass[eN,j]=-rhom*DthetaW_DpsiC+drhom*thetaW # <<<<<<<<<<<<<<
9957  *
9958  * q_kr[eN,j] = KWr
9959  */
9960  __pyx_t_34 = __pyx_v_eN;
9961  __pyx_t_35 = __pyx_v_j;
9962  __pyx_t_15 = -1;
9963  if (__pyx_t_34 < 0) {
9964  __pyx_t_34 += __pyx_pybuffernd_q_dmass.diminfo[0].shape;
9965  if (unlikely(__pyx_t_34 < 0)) __pyx_t_15 = 0;
9966  } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_q_dmass.diminfo[0].shape)) __pyx_t_15 = 0;
9967  if (__pyx_t_35 < 0) {
9968  __pyx_t_35 += __pyx_pybuffernd_q_dmass.diminfo[1].shape;
9969  if (unlikely(__pyx_t_35 < 0)) __pyx_t_15 = 1;
9970  } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_q_dmass.diminfo[1].shape)) __pyx_t_15 = 1;
9971  if (unlikely(__pyx_t_15 != -1)) {
9972  __Pyx_RaiseBufferIndexError(__pyx_t_15);
9973  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9974  }
9975  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_q_dmass.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_q_dmass.diminfo[1].strides) = (((-__pyx_v_rhom) * __pyx_v_DthetaW_DpsiC) + (__pyx_v_drhom * __pyx_v_thetaW));
9976 
9977  /* "subsurfaceTransportFunctions.pyx":454
9978  * q_dmass[eN,j]=-rhom*DthetaW_DpsiC+drhom*thetaW
9979  *
9980  * q_kr[eN,j] = KWr # <<<<<<<<<<<<<<
9981  * q_dkr[eN,j]= -DKWr_DpsiC
9982  *
9983  */
9984  __pyx_t_36 = __pyx_v_eN;
9985  __pyx_t_37 = __pyx_v_j;
9986  __pyx_t_15 = -1;
9987  if (__pyx_t_36 < 0) {
9988  __pyx_t_36 += __pyx_pybuffernd_q_kr.diminfo[0].shape;
9989  if (unlikely(__pyx_t_36 < 0)) __pyx_t_15 = 0;
9990  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_q_kr.diminfo[0].shape)) __pyx_t_15 = 0;
9991  if (__pyx_t_37 < 0) {
9992  __pyx_t_37 += __pyx_pybuffernd_q_kr.diminfo[1].shape;
9993  if (unlikely(__pyx_t_37 < 0)) __pyx_t_15 = 1;
9994  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_q_kr.diminfo[1].shape)) __pyx_t_15 = 1;
9995  if (unlikely(__pyx_t_15 != -1)) {
9996  __Pyx_RaiseBufferIndexError(__pyx_t_15);
9997  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9998  }
9999  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_q_kr.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_q_kr.diminfo[1].strides) = __pyx_v_KWr;
10000 
10001  /* "subsurfaceTransportFunctions.pyx":455
10002  *
10003  * q_kr[eN,j] = KWr
10004  * q_dkr[eN,j]= -DKWr_DpsiC # <<<<<<<<<<<<<<
10005  *
10006  * #j
10007  */
10008  __pyx_t_38 = __pyx_v_eN;
10009  __pyx_t_39 = __pyx_v_j;
10010  __pyx_t_15 = -1;
10011  if (__pyx_t_38 < 0) {
10012  __pyx_t_38 += __pyx_pybuffernd_q_dkr.diminfo[0].shape;
10013  if (unlikely(__pyx_t_38 < 0)) __pyx_t_15 = 0;
10014  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_q_dkr.diminfo[0].shape)) __pyx_t_15 = 0;
10015  if (__pyx_t_39 < 0) {
10016  __pyx_t_39 += __pyx_pybuffernd_q_dkr.diminfo[1].shape;
10017  if (unlikely(__pyx_t_39 < 0)) __pyx_t_15 = 1;
10018  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_q_dkr.diminfo[1].shape)) __pyx_t_15 = 1;
10019  if (unlikely(__pyx_t_15 != -1)) {
10020  __Pyx_RaiseBufferIndexError(__pyx_t_15);
10021  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10022  }
10023  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_q_dkr.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_q_dkr.diminfo[1].strides) = (-__pyx_v_DKWr_DpsiC);
10024  }
10025  }
10026 
10027  /* "subsurfaceTransportFunctions.pyx":461
10028  *
10029  * #now upwind kr
10030  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
10031  * u_eN = numpy.sum(q_u[eN])*nAvgWeight
10032  * kr_eN = numpy.sum(q_kr[eN])*nAvgWeight
10033  */
10034  __pyx_t_8 = __pyx_v_nElements_global;
10035  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
10036  __pyx_v_eN = __pyx_t_9;
10037 
10038  /* "subsurfaceTransportFunctions.pyx":462
10039  * #now upwind kr
10040  * for eN in range(nElements_global):
10041  * u_eN = numpy.sum(q_u[eN])*nAvgWeight # <<<<<<<<<<<<<<
10042  * kr_eN = numpy.sum(q_kr[eN])*nAvgWeight
10043  * #potential assumes slight compressibility
10044  */
10045  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10046  __Pyx_GOTREF(__pyx_t_5);
10047  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_sum); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10048  __Pyx_GOTREF(__pyx_t_1);
10049  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10050  __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_q_u), __pyx_v_eN, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
10051  __Pyx_GOTREF(__pyx_t_5);
10052  __pyx_t_4 = NULL;
10053  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
10054  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
10055  if (likely(__pyx_t_4)) {
10056  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
10057  __Pyx_INCREF(__pyx_t_4);
10058  __Pyx_INCREF(function);
10059  __Pyx_DECREF_SET(__pyx_t_1, function);
10060  }
10061  }
10062  if (!__pyx_t_4) {
10063  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10064  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10065  __Pyx_GOTREF(__pyx_t_2);
10066  } else {
10067  __pyx_t_40 = PyTuple_New(1+1); if (unlikely(!__pyx_t_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10068  __Pyx_GOTREF(__pyx_t_40);
10069  __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_40, 0, __pyx_t_4); __pyx_t_4 = NULL;
10070  __Pyx_GIVEREF(__pyx_t_5);
10071  PyTuple_SET_ITEM(__pyx_t_40, 0+1, __pyx_t_5);
10072  __pyx_t_5 = 0;
10073  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_40, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10074  __Pyx_GOTREF(__pyx_t_2);
10075  __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
10076  }
10077  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10078  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_nAvgWeight); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10079  __Pyx_GOTREF(__pyx_t_1);
10080  __pyx_t_40 = PyNumber_Multiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10081  __Pyx_GOTREF(__pyx_t_40);
10082  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10083  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10084  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_40); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10085  __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
10086  __pyx_v_u_eN = __pyx_t_7;
10087 
10088  /* "subsurfaceTransportFunctions.pyx":463
10089  * for eN in range(nElements_global):
10090  * u_eN = numpy.sum(q_u[eN])*nAvgWeight
10091  * kr_eN = numpy.sum(q_kr[eN])*nAvgWeight # <<<<<<<<<<<<<<
10092  * #potential assumes slight compressibility
10093  * phi_eN= u_eN - numpy.dot(gravity,elementBarycentersArray[eN])
10094  */
10095  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10096  __Pyx_GOTREF(__pyx_t_1);
10097  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10098  __Pyx_GOTREF(__pyx_t_2);
10099  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10100  __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_q_kr), __pyx_v_eN, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
10101  __Pyx_GOTREF(__pyx_t_1);
10102  __pyx_t_5 = NULL;
10103  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
10104  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
10105  if (likely(__pyx_t_5)) {
10106  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
10107  __Pyx_INCREF(__pyx_t_5);
10108  __Pyx_INCREF(function);
10109  __Pyx_DECREF_SET(__pyx_t_2, function);
10110  }
10111  }
10112  if (!__pyx_t_5) {
10113  __pyx_t_40 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10114  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10115  __Pyx_GOTREF(__pyx_t_40);
10116  } else {
10117  __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10118  __Pyx_GOTREF(__pyx_t_4);
10119  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
10120  __Pyx_GIVEREF(__pyx_t_1);
10121  PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_1);
10122  __pyx_t_1 = 0;
10123  __pyx_t_40 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10124  __Pyx_GOTREF(__pyx_t_40);
10125  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10126  }
10127  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10128  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_nAvgWeight); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10129  __Pyx_GOTREF(__pyx_t_2);
10130  __pyx_t_4 = PyNumber_Multiply(__pyx_t_40, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10131  __Pyx_GOTREF(__pyx_t_4);
10132  __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
10133  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10134  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10135  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10136  __pyx_v_kr_eN = __pyx_t_7;
10137 
10138  /* "subsurfaceTransportFunctions.pyx":465
10139  * kr_eN = numpy.sum(q_kr[eN])*nAvgWeight
10140  * #potential assumes slight compressibility
10141  * phi_eN= u_eN - numpy.dot(gravity,elementBarycentersArray[eN]) # <<<<<<<<<<<<<<
10142  *
10143  *
10144  */
10145  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_u_eN); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10146  __Pyx_GOTREF(__pyx_t_4);
10147  __pyx_t_40 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10148  __Pyx_GOTREF(__pyx_t_40);
10149  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_40, __pyx_n_s_dot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10150  __Pyx_GOTREF(__pyx_t_1);
10151  __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
10152  __pyx_t_40 = __Pyx_GetItemInt(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_v_eN, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_40 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
10153  __Pyx_GOTREF(__pyx_t_40);
10154  __pyx_t_5 = NULL;
10155  __pyx_t_3 = 0;
10156  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
10157  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
10158  if (likely(__pyx_t_5)) {
10159  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
10160  __Pyx_INCREF(__pyx_t_5);
10161  __Pyx_INCREF(function);
10162  __Pyx_DECREF_SET(__pyx_t_1, function);
10163  __pyx_t_3 = 1;
10164  }
10165  }
10166  __pyx_t_41 = PyTuple_New(2+__pyx_t_3); if (unlikely(!__pyx_t_41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10167  __Pyx_GOTREF(__pyx_t_41);
10168  if (__pyx_t_5) {
10169  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_41, 0, __pyx_t_5); __pyx_t_5 = NULL;
10170  }
10171  __Pyx_INCREF(((PyObject *)__pyx_v_gravity));
10172  __Pyx_GIVEREF(((PyObject *)__pyx_v_gravity));
10173  PyTuple_SET_ITEM(__pyx_t_41, 0+__pyx_t_3, ((PyObject *)__pyx_v_gravity));
10174  __Pyx_GIVEREF(__pyx_t_40);
10175  PyTuple_SET_ITEM(__pyx_t_41, 1+__pyx_t_3, __pyx_t_40);
10176  __pyx_t_40 = 0;
10177  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_41, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10178  __Pyx_GOTREF(__pyx_t_2);
10179  __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
10180  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10181  __pyx_t_1 = PyNumber_Subtract(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10182  __Pyx_GOTREF(__pyx_t_1);
10183  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10184  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10185  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10186  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10187  __pyx_v_phi_eN = __pyx_t_7;
10188 
10189  /* "subsurfaceTransportFunctions.pyx":469
10190  *
10191  * #loop over faces to upwind
10192  * for ebN in range(nElementBoundaries_element): # <<<<<<<<<<<<<<
10193  * #by default eN is upwind
10194  * q_kr_up[eN,ebN] = kr_eN
10195  */
10196  __pyx_t_11 = __pyx_v_nElementBoundaries_element;
10197  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
10198  __pyx_v_ebN = __pyx_t_12;
10199 
10200  /* "subsurfaceTransportFunctions.pyx":471
10201  * for ebN in range(nElementBoundaries_element):
10202  * #by default eN is upwind
10203  * q_kr_up[eN,ebN] = kr_eN # <<<<<<<<<<<<<<
10204  * eN_neighbor = elementNeighborsArray[eN,ebN]
10205  * if eN_neighbor >= 0:
10206  */
10207  __pyx_t_42 = __pyx_v_eN;
10208  __pyx_t_43 = __pyx_v_ebN;
10209  __pyx_t_15 = -1;
10210  if (__pyx_t_42 < 0) {
10211  __pyx_t_42 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
10212  if (unlikely(__pyx_t_42 < 0)) __pyx_t_15 = 0;
10213  } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_15 = 0;
10214  if (__pyx_t_43 < 0) {
10215  __pyx_t_43 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
10216  if (unlikely(__pyx_t_43 < 0)) __pyx_t_15 = 1;
10217  } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_15 = 1;
10218  if (unlikely(__pyx_t_15 != -1)) {
10219  __Pyx_RaiseBufferIndexError(__pyx_t_15);
10220  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10221  }
10222  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_q_kr_up.diminfo[1].strides) = __pyx_v_kr_eN;
10223 
10224  /* "subsurfaceTransportFunctions.pyx":472
10225  * #by default eN is upwind
10226  * q_kr_up[eN,ebN] = kr_eN
10227  * eN_neighbor = elementNeighborsArray[eN,ebN] # <<<<<<<<<<<<<<
10228  * if eN_neighbor >= 0:
10229  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight
10230  */
10231  __pyx_t_44 = __pyx_v_eN;
10232  __pyx_t_45 = __pyx_v_ebN;
10233  __pyx_t_15 = -1;
10234  if (__pyx_t_44 < 0) {
10235  __pyx_t_44 += __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape;
10236  if (unlikely(__pyx_t_44 < 0)) __pyx_t_15 = 0;
10237  } else if (unlikely(__pyx_t_44 >= __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape)) __pyx_t_15 = 0;
10238  if (__pyx_t_45 < 0) {
10239  __pyx_t_45 += __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape;
10240  if (unlikely(__pyx_t_45 < 0)) __pyx_t_15 = 1;
10241  } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape)) __pyx_t_15 = 1;
10242  if (unlikely(__pyx_t_15 != -1)) {
10243  __Pyx_RaiseBufferIndexError(__pyx_t_15);
10244  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10245  }
10246  __pyx_v_eN_neighbor = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides));
10247 
10248  /* "subsurfaceTransportFunctions.pyx":473
10249  * q_kr_up[eN,ebN] = kr_eN
10250  * eN_neighbor = elementNeighborsArray[eN,ebN]
10251  * if eN_neighbor >= 0: # <<<<<<<<<<<<<<
10252  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight
10253  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight
10254  */
10255  __pyx_t_6 = ((__pyx_v_eN_neighbor >= 0) != 0);
10256  if (__pyx_t_6) {
10257 
10258  /* "subsurfaceTransportFunctions.pyx":474
10259  * eN_neighbor = elementNeighborsArray[eN,ebN]
10260  * if eN_neighbor >= 0:
10261  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight # <<<<<<<<<<<<<<
10262  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight
10263  * #potential, assumes slight compressibility
10264  */
10265  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10266  __Pyx_GOTREF(__pyx_t_2);
10267  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sum); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10268  __Pyx_GOTREF(__pyx_t_4);
10269  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10270  __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_q_u), __pyx_v_eN_neighbor, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
10271  __Pyx_GOTREF(__pyx_t_2);
10272  __pyx_t_41 = NULL;
10273  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
10274  __pyx_t_41 = PyMethod_GET_SELF(__pyx_t_4);
10275  if (likely(__pyx_t_41)) {
10276  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
10277  __Pyx_INCREF(__pyx_t_41);
10278  __Pyx_INCREF(function);
10279  __Pyx_DECREF_SET(__pyx_t_4, function);
10280  }
10281  }
10282  if (!__pyx_t_41) {
10283  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10284  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10285  __Pyx_GOTREF(__pyx_t_1);
10286  } else {
10287  __pyx_t_40 = PyTuple_New(1+1); if (unlikely(!__pyx_t_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10288  __Pyx_GOTREF(__pyx_t_40);
10289  __Pyx_GIVEREF(__pyx_t_41); PyTuple_SET_ITEM(__pyx_t_40, 0, __pyx_t_41); __pyx_t_41 = NULL;
10290  __Pyx_GIVEREF(__pyx_t_2);
10291  PyTuple_SET_ITEM(__pyx_t_40, 0+1, __pyx_t_2);
10292  __pyx_t_2 = 0;
10293  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_40, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10294  __Pyx_GOTREF(__pyx_t_1);
10295  __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
10296  }
10297  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10298  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_nAvgWeight); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10299  __Pyx_GOTREF(__pyx_t_4);
10300  __pyx_t_40 = PyNumber_Multiply(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10301  __Pyx_GOTREF(__pyx_t_40);
10302  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10303  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10304  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_40); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10305  __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
10306  __pyx_v_u_neig = __pyx_t_7;
10307 
10308  /* "subsurfaceTransportFunctions.pyx":475
10309  * if eN_neighbor >= 0:
10310  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight
10311  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight # <<<<<<<<<<<<<<
10312  * #potential, assumes slight compressibility
10313  * phi_neig= u_neig - numpy.dot(gravity,elementBarycentersArray[eN_neighbor])
10314  */
10315  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10316  __Pyx_GOTREF(__pyx_t_4);
10317  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_sum); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10318  __Pyx_GOTREF(__pyx_t_1);
10319  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10320  __pyx_t_4 = __Pyx_GetItemInt(((PyObject *)__pyx_v_q_kr), __pyx_v_eN_neighbor, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
10321  __Pyx_GOTREF(__pyx_t_4);
10322  __pyx_t_2 = NULL;
10323  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
10324  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
10325  if (likely(__pyx_t_2)) {
10326  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
10327  __Pyx_INCREF(__pyx_t_2);
10328  __Pyx_INCREF(function);
10329  __Pyx_DECREF_SET(__pyx_t_1, function);
10330  }
10331  }
10332  if (!__pyx_t_2) {
10333  __pyx_t_40 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10334  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10335  __Pyx_GOTREF(__pyx_t_40);
10336  } else {
10337  __pyx_t_41 = PyTuple_New(1+1); if (unlikely(!__pyx_t_41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10338  __Pyx_GOTREF(__pyx_t_41);
10339  __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_41, 0, __pyx_t_2); __pyx_t_2 = NULL;
10340  __Pyx_GIVEREF(__pyx_t_4);
10341  PyTuple_SET_ITEM(__pyx_t_41, 0+1, __pyx_t_4);
10342  __pyx_t_4 = 0;
10343  __pyx_t_40 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_41, NULL); if (unlikely(!__pyx_t_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10344  __Pyx_GOTREF(__pyx_t_40);
10345  __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
10346  }
10347  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10348  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_nAvgWeight); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10349  __Pyx_GOTREF(__pyx_t_1);
10350  __pyx_t_41 = PyNumber_Multiply(__pyx_t_40, __pyx_t_1); if (unlikely(!__pyx_t_41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10351  __Pyx_GOTREF(__pyx_t_41);
10352  __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
10353  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10354  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_41); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10355  __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
10356  __pyx_v_kr_neig = __pyx_t_7;
10357 
10358  /* "subsurfaceTransportFunctions.pyx":477
10359  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight
10360  * #potential, assumes slight compressibility
10361  * phi_neig= u_neig - numpy.dot(gravity,elementBarycentersArray[eN_neighbor]) # <<<<<<<<<<<<<<
10362  *
10363  * if phi_eN < phi_neig: #neighbor is upwind
10364  */
10365  __pyx_t_41 = PyFloat_FromDouble(__pyx_v_u_neig); if (unlikely(!__pyx_t_41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10366  __Pyx_GOTREF(__pyx_t_41);
10367  __pyx_t_40 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10368  __Pyx_GOTREF(__pyx_t_40);
10369  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_40, __pyx_n_s_dot); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10370  __Pyx_GOTREF(__pyx_t_4);
10371  __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
10372  __pyx_t_40 = __Pyx_GetItemInt(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_v_eN_neighbor, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_40 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
10373  __Pyx_GOTREF(__pyx_t_40);
10374  __pyx_t_2 = NULL;
10375  __pyx_t_3 = 0;
10376  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
10377  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
10378  if (likely(__pyx_t_2)) {
10379  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
10380  __Pyx_INCREF(__pyx_t_2);
10381  __Pyx_INCREF(function);
10382  __Pyx_DECREF_SET(__pyx_t_4, function);
10383  __pyx_t_3 = 1;
10384  }
10385  }
10386  __pyx_t_5 = PyTuple_New(2+__pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10387  __Pyx_GOTREF(__pyx_t_5);
10388  if (__pyx_t_2) {
10389  __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
10390  }
10391  __Pyx_INCREF(((PyObject *)__pyx_v_gravity));
10392  __Pyx_GIVEREF(((PyObject *)__pyx_v_gravity));
10393  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_3, ((PyObject *)__pyx_v_gravity));
10394  __Pyx_GIVEREF(__pyx_t_40);
10395  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_3, __pyx_t_40);
10396  __pyx_t_40 = 0;
10397  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10398  __Pyx_GOTREF(__pyx_t_1);
10399  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10400  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10401  __pyx_t_4 = PyNumber_Subtract(__pyx_t_41, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10402  __Pyx_GOTREF(__pyx_t_4);
10403  __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
10404  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10405  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10406  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10407  __pyx_v_phi_neig = __pyx_t_7;
10408 
10409  /* "subsurfaceTransportFunctions.pyx":479
10410  * phi_neig= u_neig - numpy.dot(gravity,elementBarycentersArray[eN_neighbor])
10411  *
10412  * if phi_eN < phi_neig: #neighbor is upwind # <<<<<<<<<<<<<<
10413  * q_kr_up[eN,ebN] = kr_neig
10414  *
10415  */
10416  __pyx_t_6 = ((__pyx_v_phi_eN < __pyx_v_phi_neig) != 0);
10417  if (__pyx_t_6) {
10418 
10419  /* "subsurfaceTransportFunctions.pyx":480
10420  *
10421  * if phi_eN < phi_neig: #neighbor is upwind
10422  * q_kr_up[eN,ebN] = kr_neig # <<<<<<<<<<<<<<
10423  *
10424  * #neighbor
10425  */
10426  __pyx_t_46 = __pyx_v_eN;
10427  __pyx_t_47 = __pyx_v_ebN;
10428  __pyx_t_15 = -1;
10429  if (__pyx_t_46 < 0) {
10430  __pyx_t_46 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
10431  if (unlikely(__pyx_t_46 < 0)) __pyx_t_15 = 0;
10432  } else if (unlikely(__pyx_t_46 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_15 = 0;
10433  if (__pyx_t_47 < 0) {
10434  __pyx_t_47 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
10435  if (unlikely(__pyx_t_47 < 0)) __pyx_t_15 = 1;
10436  } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_15 = 1;
10437  if (unlikely(__pyx_t_15 != -1)) {
10438  __Pyx_RaiseBufferIndexError(__pyx_t_15);
10439  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10440  }
10441  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_47, __pyx_pybuffernd_q_kr_up.diminfo[1].strides) = __pyx_v_kr_neig;
10442 
10443  /* "subsurfaceTransportFunctions.pyx":479
10444  * phi_neig= u_neig - numpy.dot(gravity,elementBarycentersArray[eN_neighbor])
10445  *
10446  * if phi_eN < phi_neig: #neighbor is upwind # <<<<<<<<<<<<<<
10447  * q_kr_up[eN,ebN] = kr_neig
10448  *
10449  */
10450  }
10451 
10452  /* "subsurfaceTransportFunctions.pyx":473
10453  * q_kr_up[eN,ebN] = kr_eN
10454  * eN_neighbor = elementNeighborsArray[eN,ebN]
10455  * if eN_neighbor >= 0: # <<<<<<<<<<<<<<
10456  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight
10457  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight
10458  */
10459  }
10460  }
10461  }
10462 
10463  /* "subsurfaceTransportFunctions.pyx":359
10464  *
10465  *
10466  * def RE_NCP1_evaluateElementCoefficients_VGM(double rho, # <<<<<<<<<<<<<<
10467  * double beta,
10468  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
10469  */
10470 
10471  /* function exit code */
10472  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10473  goto __pyx_L0;
10474  __pyx_L1_error:;
10475  __Pyx_XDECREF(__pyx_t_1);
10476  __Pyx_XDECREF(__pyx_t_2);
10477  __Pyx_XDECREF(__pyx_t_4);
10478  __Pyx_XDECREF(__pyx_t_5);
10479  __Pyx_XDECREF(__pyx_t_40);
10480  __Pyx_XDECREF(__pyx_t_41);
10481  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
10482  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
10483  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alpha.rcbuffer->pybuffer);
10484  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
10485  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
10486  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
10487  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
10488  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_n.rcbuffer->pybuffer);
10489  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer);
10490  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dmass.rcbuffer->pybuffer);
10491  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
10492  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
10493  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mass.rcbuffer->pybuffer);
10494  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
10495  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
10496  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_x.rcbuffer->pybuffer);
10497  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_thetaR.rcbuffer->pybuffer);
10498  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_thetaSR.rcbuffer->pybuffer);
10499  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_u_dof.rcbuffer->pybuffer);
10500  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_u_l2g.rcbuffer->pybuffer);
10501  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
10502  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_evaluateElementCoefficients_VGM", __pyx_clineno, __pyx_lineno, __pyx_filename);
10503  __pyx_r = NULL;
10504  goto __pyx_L2;
10505  __pyx_L0:;
10506  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alpha.rcbuffer->pybuffer);
10507  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
10508  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
10509  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
10510  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
10511  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_n.rcbuffer->pybuffer);
10512  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer);
10513  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dmass.rcbuffer->pybuffer);
10514  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
10515  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
10516  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mass.rcbuffer->pybuffer);
10517  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
10518  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
10519  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_x.rcbuffer->pybuffer);
10520  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_thetaR.rcbuffer->pybuffer);
10521  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_thetaSR.rcbuffer->pybuffer);
10522  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_u_dof.rcbuffer->pybuffer);
10523  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_u_l2g.rcbuffer->pybuffer);
10524  __pyx_L2:;
10525  __Pyx_XDECREF(__pyx_v_q);
10526  __Pyx_XGIVEREF(__pyx_r);
10527  __Pyx_RefNannyFinishContext();
10528  return __pyx_r;
10529 }
10530 
10531 /* "subsurfaceTransportFunctions.pyx":486
10532  * #eN for upwind
10533  *
10534  * def RE_NCP1_getElementResidual(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
10535  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
10536  * numpy.ndarray[ITYPE_t,ndim=1] colind,
10537  */
10538 
10539 /* Python wrapper */
10540 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
10541 static char __pyx_doc_28subsurfaceTransportFunctions_32RE_NCP1_getElementResidual[] = "\n residual routine for NCP1 approximation for conservative head formulation of Richards equation \n\n Approximation:\n uses nodal quadrature where the nodes are face barycenters\n uses harmonic average for intrinsic permeability/ hydraulic conductivity\n upwinds relative permeability based on element averages\n applies dirichlet boundary conditions strongly but keeps dofs in system\n\n TODO:\n everything\n \n ";
10542 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual = {"RE_NCP1_getElementResidual", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_32RE_NCP1_getElementResidual};
10543 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
10544  CYTHON_UNUSED PyArrayObject *__pyx_v_gravity = 0;
10545  PyArrayObject *__pyx_v_rowptr = 0;
10546  PyArrayObject *__pyx_v_colind = 0;
10547  int __pyx_v_nSpace;
10548  int __pyx_v_nElements_global;
10549  int __pyx_v_nElementBoundaries_element;
10550  CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray = 0;
10551  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray = 0;
10552  int __pyx_v_nDOF_test_element;
10553  PyArrayObject *__pyx_v_q_u = 0;
10554  PyArrayObject *__pyx_v_q_grad_u = 0;
10555  PyArrayObject *__pyx_v_q_grad_w = 0;
10556  PyArrayObject *__pyx_v_q_detJ = 0;
10557  PyArrayObject *__pyx_v_q_m = 0;
10558  PyArrayObject *__pyx_v_q_mt = 0;
10559  PyArrayObject *__pyx_v_q_r = 0;
10560  PyArrayObject *__pyx_v_q_kr = 0;
10561  PyArrayObject *__pyx_v_q_kr_up = 0;
10562  PyArrayObject *__pyx_v_q_flin = 0;
10563  PyArrayObject *__pyx_v_q_alin = 0;
10564  PyArrayObject *__pyx_v_elementResidual = 0;
10565  int __pyx_lineno = 0;
10566  const char *__pyx_filename = NULL;
10567  int __pyx_clineno = 0;
10568  PyObject *__pyx_r = 0;
10569  __Pyx_RefNannyDeclarations
10570  __Pyx_RefNannySetupContext("RE_NCP1_getElementResidual (wrapper)", 0);
10571  {
10572  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gravity,&__pyx_n_s_rowptr,&__pyx_n_s_colind,&__pyx_n_s_nSpace,&__pyx_n_s_nElements_global,&__pyx_n_s_nElementBoundaries_element,&__pyx_n_s_elementNeighborsArray,&__pyx_n_s_elementBarycentersArray,&__pyx_n_s_nDOF_test_element,&__pyx_n_s_q_u,&__pyx_n_s_q_grad_u,&__pyx_n_s_q_grad_w,&__pyx_n_s_q_detJ,&__pyx_n_s_q_m,&__pyx_n_s_q_mt,&__pyx_n_s_q_r,&__pyx_n_s_q_kr,&__pyx_n_s_q_kr_up,&__pyx_n_s_q_flin,&__pyx_n_s_q_alin,&__pyx_n_s_elementResidual,0};
10573  PyObject* values[21] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
10574  if (unlikely(__pyx_kwds)) {
10575  Py_ssize_t kw_args;
10576  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
10577  switch (pos_args) {
10578  case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
10579  case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
10580  case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
10581  case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
10582  case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
10583  case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
10584  case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
10585  case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
10586  case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
10587  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
10588  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
10589  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
10590  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
10591  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
10592  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
10593  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
10594  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
10595  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
10596  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10597  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10598  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10599  case 0: break;
10600  default: goto __pyx_L5_argtuple_error;
10601  }
10602  kw_args = PyDict_Size(__pyx_kwds);
10603  switch (pos_args) {
10604  case 0:
10605  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_gravity)) != 0)) kw_args--;
10606  else goto __pyx_L5_argtuple_error;
10607  case 1:
10608  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rowptr)) != 0)) kw_args--;
10609  else {
10610  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
10611  }
10612  case 2:
10613  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_colind)) != 0)) kw_args--;
10614  else {
10615  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
10616  }
10617  case 3:
10618  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nSpace)) != 0)) kw_args--;
10619  else {
10620  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
10621  }
10622  case 4:
10623  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nElements_global)) != 0)) kw_args--;
10624  else {
10625  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
10626  }
10627  case 5:
10628  if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nElementBoundaries_element)) != 0)) kw_args--;
10629  else {
10630  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
10631  }
10632  case 6:
10633  if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementNeighborsArray)) != 0)) kw_args--;
10634  else {
10635  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
10636  }
10637  case 7:
10638  if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
10639  else {
10640  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
10641  }
10642  case 8:
10643  if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nDOF_test_element)) != 0)) kw_args--;
10644  else {
10645  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
10646  }
10647  case 9:
10648  if (likely((values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_u)) != 0)) kw_args--;
10649  else {
10650  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
10651  }
10652  case 10:
10653  if (likely((values[10] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_grad_u)) != 0)) kw_args--;
10654  else {
10655  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 10); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
10656  }
10657  case 11:
10658  if (likely((values[11] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_grad_w)) != 0)) kw_args--;
10659  else {
10660  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 11); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
10661  }
10662  case 12:
10663  if (likely((values[12] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_detJ)) != 0)) kw_args--;
10664  else {
10665  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 12); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
10666  }
10667  case 13:
10668  if (likely((values[13] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_m)) != 0)) kw_args--;
10669  else {
10670  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 13); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
10671  }
10672  case 14:
10673  if (likely((values[14] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_mt)) != 0)) kw_args--;
10674  else {
10675  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 14); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
10676  }
10677  case 15:
10678  if (likely((values[15] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_r)) != 0)) kw_args--;
10679  else {
10680  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 15); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
10681  }
10682  case 16:
10683  if (likely((values[16] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_kr)) != 0)) kw_args--;
10684  else {
10685  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 16); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
10686  }
10687  case 17:
10688  if (likely((values[17] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_kr_up)) != 0)) kw_args--;
10689  else {
10690  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 17); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
10691  }
10692  case 18:
10693  if (likely((values[18] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_flin)) != 0)) kw_args--;
10694  else {
10695  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 18); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
10696  }
10697  case 19:
10698  if (likely((values[19] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_alin)) != 0)) kw_args--;
10699  else {
10700  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 19); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
10701  }
10702  case 20:
10703  if (likely((values[20] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementResidual)) != 0)) kw_args--;
10704  else {
10705  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 20); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
10706  }
10707  }
10708  if (unlikely(kw_args > 0)) {
10709  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RE_NCP1_getElementResidual") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
10710  }
10711  } else if (PyTuple_GET_SIZE(__pyx_args) != 21) {
10712  goto __pyx_L5_argtuple_error;
10713  } else {
10714  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10715  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10716  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10717  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
10718  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
10719  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
10720  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
10721  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
10722  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
10723  values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
10724  values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
10725  values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
10726  values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
10727  values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
10728  values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
10729  values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
10730  values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
10731  values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
10732  values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
10733  values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
10734  values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
10735  }
10736  __pyx_v_gravity = ((PyArrayObject *)values[0]);
10737  __pyx_v_rowptr = ((PyArrayObject *)values[1]);
10738  __pyx_v_colind = ((PyArrayObject *)values[2]);
10739  __pyx_v_nSpace = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nSpace == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
10740  __pyx_v_nElements_global = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_nElements_global == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
10741  __pyx_v_nElementBoundaries_element = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nElementBoundaries_element == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
10742  __pyx_v_elementNeighborsArray = ((PyArrayObject *)values[6]);
10743  __pyx_v_elementBarycentersArray = ((PyArrayObject *)values[7]);
10744  __pyx_v_nDOF_test_element = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_nDOF_test_element == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
10745  __pyx_v_q_u = ((PyArrayObject *)values[9]);
10746  __pyx_v_q_grad_u = ((PyArrayObject *)values[10]);
10747  __pyx_v_q_grad_w = ((PyArrayObject *)values[11]);
10748  __pyx_v_q_detJ = ((PyArrayObject *)values[12]);
10749  __pyx_v_q_m = ((PyArrayObject *)values[13]);
10750  __pyx_v_q_mt = ((PyArrayObject *)values[14]);
10751  __pyx_v_q_r = ((PyArrayObject *)values[15]);
10752  __pyx_v_q_kr = ((PyArrayObject *)values[16]);
10753  __pyx_v_q_kr_up = ((PyArrayObject *)values[17]);
10754  __pyx_v_q_flin = ((PyArrayObject *)values[18]);
10755  __pyx_v_q_alin = ((PyArrayObject *)values[19]);
10756  __pyx_v_elementResidual = ((PyArrayObject *)values[20]);
10757  }
10758  goto __pyx_L4_argument_unpacking_done;
10759  __pyx_L5_argtuple_error:;
10760  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
10761  __pyx_L3_error:;
10762  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_getElementResidual", __pyx_clineno, __pyx_lineno, __pyx_filename);
10763  __Pyx_RefNannyFinishContext();
10764  return NULL;
10765  __pyx_L4_argument_unpacking_done:;
10766  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gravity), __pyx_ptype_5numpy_ndarray, 1, "gravity", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10767  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rowptr), __pyx_ptype_5numpy_ndarray, 1, "rowptr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10768  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_colind), __pyx_ptype_5numpy_ndarray, 1, "colind", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10769  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementNeighborsArray), __pyx_ptype_5numpy_ndarray, 1, "elementNeighborsArray", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10770  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_ptype_5numpy_ndarray, 1, "elementBarycentersArray", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10771  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_u), __pyx_ptype_5numpy_ndarray, 1, "q_u", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10772  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_u), __pyx_ptype_5numpy_ndarray, 1, "q_grad_u", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10773  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_w), __pyx_ptype_5numpy_ndarray, 1, "q_grad_w", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10774  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_detJ), __pyx_ptype_5numpy_ndarray, 1, "q_detJ", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10775  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_m), __pyx_ptype_5numpy_ndarray, 1, "q_m", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10776  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_mt), __pyx_ptype_5numpy_ndarray, 1, "q_mt", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10777  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_r), __pyx_ptype_5numpy_ndarray, 1, "q_r", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10778  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr), __pyx_ptype_5numpy_ndarray, 1, "q_kr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10779  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr_up), __pyx_ptype_5numpy_ndarray, 1, "q_kr_up", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10780  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_flin), __pyx_ptype_5numpy_ndarray, 1, "q_flin", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10781  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_alin), __pyx_ptype_5numpy_ndarray, 1, "q_alin", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10782  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementResidual), __pyx_ptype_5numpy_ndarray, 1, "elementResidual", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10783  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_32RE_NCP1_getElementResidual(__pyx_self, __pyx_v_gravity, __pyx_v_rowptr, __pyx_v_colind, __pyx_v_nSpace, __pyx_v_nElements_global, __pyx_v_nElementBoundaries_element, __pyx_v_elementNeighborsArray, __pyx_v_elementBarycentersArray, __pyx_v_nDOF_test_element, __pyx_v_q_u, __pyx_v_q_grad_u, __pyx_v_q_grad_w, __pyx_v_q_detJ, __pyx_v_q_m, __pyx_v_q_mt, __pyx_v_q_r, __pyx_v_q_kr, __pyx_v_q_kr_up, __pyx_v_q_flin, __pyx_v_q_alin, __pyx_v_elementResidual);
10784 
10785  /* function exit code */
10786  goto __pyx_L0;
10787  __pyx_L1_error:;
10788  __pyx_r = NULL;
10789  __pyx_L0:;
10790  __Pyx_RefNannyFinishContext();
10791  return __pyx_r;
10792 }
10793 
10794 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_32RE_NCP1_getElementResidual(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray, int __pyx_v_nDOF_test_element, PyArrayObject *__pyx_v_q_u, PyArrayObject *__pyx_v_q_grad_u, PyArrayObject *__pyx_v_q_grad_w, PyArrayObject *__pyx_v_q_detJ, PyArrayObject *__pyx_v_q_m, PyArrayObject *__pyx_v_q_mt, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, PyArrayObject *__pyx_v_q_kr_up, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin, PyArrayObject *__pyx_v_elementResidual) {
10795  CYTHON_UNUSED int __pyx_v_upwindFlag;
10796  PyObject *__pyx_v_q = NULL;
10797  int __pyx_v_nnz;
10798  int __pyx_v_eN;
10799  int __pyx_v_ii;
10800  int __pyx_v_I;
10801  int __pyx_v_i;
10802  int __pyx_v_ebN;
10803  PyArrayObject *__pyx_v_a_up = 0;
10804  PyArrayObject *__pyx_v_f_up = 0;
10805  double __pyx_v_nAvgWeight;
10806  double __pyx_v_weight;
10807  double __pyx_v_volFactor;
10808  double __pyx_v_volume;
10809  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_up;
10810  __Pyx_Buffer __pyx_pybuffer_a_up;
10811  __Pyx_LocalBuf_ND __pyx_pybuffernd_colind;
10812  __Pyx_Buffer __pyx_pybuffer_colind;
10813  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBarycentersArray;
10814  __Pyx_Buffer __pyx_pybuffer_elementBarycentersArray;
10815  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementNeighborsArray;
10816  __Pyx_Buffer __pyx_pybuffer_elementNeighborsArray;
10817  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementResidual;
10818  __Pyx_Buffer __pyx_pybuffer_elementResidual;
10819  __Pyx_LocalBuf_ND __pyx_pybuffernd_f_up;
10820  __Pyx_Buffer __pyx_pybuffer_f_up;
10821  __Pyx_LocalBuf_ND __pyx_pybuffernd_gravity;
10822  __Pyx_Buffer __pyx_pybuffer_gravity;
10823  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_alin;
10824  __Pyx_Buffer __pyx_pybuffer_q_alin;
10825  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_detJ;
10826  __Pyx_Buffer __pyx_pybuffer_q_detJ;
10827  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_flin;
10828  __Pyx_Buffer __pyx_pybuffer_q_flin;
10829  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_u;
10830  __Pyx_Buffer __pyx_pybuffer_q_grad_u;
10831  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_w;
10832  __Pyx_Buffer __pyx_pybuffer_q_grad_w;
10833  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr;
10834  __Pyx_Buffer __pyx_pybuffer_q_kr;
10835  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr_up;
10836  __Pyx_Buffer __pyx_pybuffer_q_kr_up;
10837  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_m;
10838  __Pyx_Buffer __pyx_pybuffer_q_m;
10839  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_mt;
10840  __Pyx_Buffer __pyx_pybuffer_q_mt;
10841  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_r;
10842  __Pyx_Buffer __pyx_pybuffer_q_r;
10843  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_u;
10844  __Pyx_Buffer __pyx_pybuffer_q_u;
10845  __Pyx_LocalBuf_ND __pyx_pybuffernd_rowptr;
10846  __Pyx_Buffer __pyx_pybuffer_rowptr;
10847  PyObject *__pyx_r = NULL;
10848  __Pyx_RefNannyDeclarations
10849  PyObject *__pyx_t_1 = NULL;
10850  PyObject *__pyx_t_2 = NULL;
10851  Py_ssize_t __pyx_t_3;
10852  PyObject *__pyx_t_4 = NULL;
10853  PyObject *__pyx_t_5 = NULL;
10854  int __pyx_t_6;
10855  Py_ssize_t __pyx_t_7;
10856  int __pyx_t_8;
10857  PyObject *__pyx_t_9 = NULL;
10858  PyArrayObject *__pyx_t_10 = NULL;
10859  PyArrayObject *__pyx_t_11 = NULL;
10860  double __pyx_t_12;
10861  int __pyx_t_13;
10862  Py_ssize_t __pyx_t_14;
10863  Py_ssize_t __pyx_t_15;
10864  int __pyx_t_16;
10865  int __pyx_t_17;
10866  Py_ssize_t __pyx_t_18;
10867  Py_ssize_t __pyx_t_19;
10868  int __pyx_t_20;
10869  Py_ssize_t __pyx_t_21;
10870  Py_ssize_t __pyx_t_22;
10871  Py_ssize_t __pyx_t_23;
10872  Py_ssize_t __pyx_t_24;
10873  Py_ssize_t __pyx_t_25;
10874  Py_ssize_t __pyx_t_26;
10875  int __pyx_t_27;
10876  int __pyx_t_28;
10877  int __pyx_t_29;
10878  Py_ssize_t __pyx_t_30;
10879  Py_ssize_t __pyx_t_31;
10880  Py_ssize_t __pyx_t_32;
10881  int __pyx_t_33;
10882  Py_ssize_t __pyx_t_34;
10883  Py_ssize_t __pyx_t_35;
10884  Py_ssize_t __pyx_t_36;
10885  Py_ssize_t __pyx_t_37;
10886  Py_ssize_t __pyx_t_38;
10887  Py_ssize_t __pyx_t_39;
10888  Py_ssize_t __pyx_t_40;
10889  Py_ssize_t __pyx_t_41;
10890  Py_ssize_t __pyx_t_42;
10891  Py_ssize_t __pyx_t_43;
10892  Py_ssize_t __pyx_t_44;
10893  Py_ssize_t __pyx_t_45;
10894  Py_ssize_t __pyx_t_46;
10895  Py_ssize_t __pyx_t_47;
10896  Py_ssize_t __pyx_t_48;
10897  Py_ssize_t __pyx_t_49;
10898  Py_ssize_t __pyx_t_50;
10899  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_51;
10900  Py_ssize_t __pyx_t_52;
10901  Py_ssize_t __pyx_t_53;
10902  int __pyx_t_54;
10903  Py_ssize_t __pyx_t_55;
10904  Py_ssize_t __pyx_t_56;
10905  Py_ssize_t __pyx_t_57;
10906  Py_ssize_t __pyx_t_58;
10907  Py_ssize_t __pyx_t_59;
10908  Py_ssize_t __pyx_t_60;
10909  Py_ssize_t __pyx_t_61;
10910  Py_ssize_t __pyx_t_62;
10911  Py_ssize_t __pyx_t_63;
10912  Py_ssize_t __pyx_t_64;
10913  int __pyx_lineno = 0;
10914  const char *__pyx_filename = NULL;
10915  int __pyx_clineno = 0;
10916  __Pyx_RefNannySetupContext("RE_NCP1_getElementResidual", 0);
10917  __pyx_pybuffer_a_up.pybuffer.buf = NULL;
10918  __pyx_pybuffer_a_up.refcount = 0;
10919  __pyx_pybuffernd_a_up.data = NULL;
10920  __pyx_pybuffernd_a_up.rcbuffer = &__pyx_pybuffer_a_up;
10921  __pyx_pybuffer_f_up.pybuffer.buf = NULL;
10922  __pyx_pybuffer_f_up.refcount = 0;
10923  __pyx_pybuffernd_f_up.data = NULL;
10924  __pyx_pybuffernd_f_up.rcbuffer = &__pyx_pybuffer_f_up;
10925  __pyx_pybuffer_gravity.pybuffer.buf = NULL;
10926  __pyx_pybuffer_gravity.refcount = 0;
10927  __pyx_pybuffernd_gravity.data = NULL;
10928  __pyx_pybuffernd_gravity.rcbuffer = &__pyx_pybuffer_gravity;
10929  __pyx_pybuffer_rowptr.pybuffer.buf = NULL;
10930  __pyx_pybuffer_rowptr.refcount = 0;
10931  __pyx_pybuffernd_rowptr.data = NULL;
10932  __pyx_pybuffernd_rowptr.rcbuffer = &__pyx_pybuffer_rowptr;
10933  __pyx_pybuffer_colind.pybuffer.buf = NULL;
10934  __pyx_pybuffer_colind.refcount = 0;
10935  __pyx_pybuffernd_colind.data = NULL;
10936  __pyx_pybuffernd_colind.rcbuffer = &__pyx_pybuffer_colind;
10937  __pyx_pybuffer_elementNeighborsArray.pybuffer.buf = NULL;
10938  __pyx_pybuffer_elementNeighborsArray.refcount = 0;
10939  __pyx_pybuffernd_elementNeighborsArray.data = NULL;
10940  __pyx_pybuffernd_elementNeighborsArray.rcbuffer = &__pyx_pybuffer_elementNeighborsArray;
10941  __pyx_pybuffer_elementBarycentersArray.pybuffer.buf = NULL;
10942  __pyx_pybuffer_elementBarycentersArray.refcount = 0;
10943  __pyx_pybuffernd_elementBarycentersArray.data = NULL;
10944  __pyx_pybuffernd_elementBarycentersArray.rcbuffer = &__pyx_pybuffer_elementBarycentersArray;
10945  __pyx_pybuffer_q_u.pybuffer.buf = NULL;
10946  __pyx_pybuffer_q_u.refcount = 0;
10947  __pyx_pybuffernd_q_u.data = NULL;
10948  __pyx_pybuffernd_q_u.rcbuffer = &__pyx_pybuffer_q_u;
10949  __pyx_pybuffer_q_grad_u.pybuffer.buf = NULL;
10950  __pyx_pybuffer_q_grad_u.refcount = 0;
10951  __pyx_pybuffernd_q_grad_u.data = NULL;
10952  __pyx_pybuffernd_q_grad_u.rcbuffer = &__pyx_pybuffer_q_grad_u;
10953  __pyx_pybuffer_q_grad_w.pybuffer.buf = NULL;
10954  __pyx_pybuffer_q_grad_w.refcount = 0;
10955  __pyx_pybuffernd_q_grad_w.data = NULL;
10956  __pyx_pybuffernd_q_grad_w.rcbuffer = &__pyx_pybuffer_q_grad_w;
10957  __pyx_pybuffer_q_detJ.pybuffer.buf = NULL;
10958  __pyx_pybuffer_q_detJ.refcount = 0;
10959  __pyx_pybuffernd_q_detJ.data = NULL;
10960  __pyx_pybuffernd_q_detJ.rcbuffer = &__pyx_pybuffer_q_detJ;
10961  __pyx_pybuffer_q_m.pybuffer.buf = NULL;
10962  __pyx_pybuffer_q_m.refcount = 0;
10963  __pyx_pybuffernd_q_m.data = NULL;
10964  __pyx_pybuffernd_q_m.rcbuffer = &__pyx_pybuffer_q_m;
10965  __pyx_pybuffer_q_mt.pybuffer.buf = NULL;
10966  __pyx_pybuffer_q_mt.refcount = 0;
10967  __pyx_pybuffernd_q_mt.data = NULL;
10968  __pyx_pybuffernd_q_mt.rcbuffer = &__pyx_pybuffer_q_mt;
10969  __pyx_pybuffer_q_r.pybuffer.buf = NULL;
10970  __pyx_pybuffer_q_r.refcount = 0;
10971  __pyx_pybuffernd_q_r.data = NULL;
10972  __pyx_pybuffernd_q_r.rcbuffer = &__pyx_pybuffer_q_r;
10973  __pyx_pybuffer_q_kr.pybuffer.buf = NULL;
10974  __pyx_pybuffer_q_kr.refcount = 0;
10975  __pyx_pybuffernd_q_kr.data = NULL;
10976  __pyx_pybuffernd_q_kr.rcbuffer = &__pyx_pybuffer_q_kr;
10977  __pyx_pybuffer_q_kr_up.pybuffer.buf = NULL;
10978  __pyx_pybuffer_q_kr_up.refcount = 0;
10979  __pyx_pybuffernd_q_kr_up.data = NULL;
10980  __pyx_pybuffernd_q_kr_up.rcbuffer = &__pyx_pybuffer_q_kr_up;
10981  __pyx_pybuffer_q_flin.pybuffer.buf = NULL;
10982  __pyx_pybuffer_q_flin.refcount = 0;
10983  __pyx_pybuffernd_q_flin.data = NULL;
10984  __pyx_pybuffernd_q_flin.rcbuffer = &__pyx_pybuffer_q_flin;
10985  __pyx_pybuffer_q_alin.pybuffer.buf = NULL;
10986  __pyx_pybuffer_q_alin.refcount = 0;
10987  __pyx_pybuffernd_q_alin.data = NULL;
10988  __pyx_pybuffernd_q_alin.rcbuffer = &__pyx_pybuffer_q_alin;
10989  __pyx_pybuffer_elementResidual.pybuffer.buf = NULL;
10990  __pyx_pybuffer_elementResidual.refcount = 0;
10991  __pyx_pybuffernd_elementResidual.data = NULL;
10992  __pyx_pybuffernd_elementResidual.rcbuffer = &__pyx_pybuffer_elementResidual;
10993  {
10994  __Pyx_BufFmt_StackElem __pyx_stack[1];
10995  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer, (PyObject*)__pyx_v_gravity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10996  }
10997  __pyx_pybuffernd_gravity.diminfo[0].strides = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_gravity.diminfo[0].shape = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.shape[0];
10998  {
10999  __Pyx_BufFmt_StackElem __pyx_stack[1];
11000  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_rowptr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11001  }
11002  __pyx_pybuffernd_rowptr.diminfo[0].strides = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rowptr.diminfo[0].shape = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.shape[0];
11003  {
11004  __Pyx_BufFmt_StackElem __pyx_stack[1];
11005  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_colind.rcbuffer->pybuffer, (PyObject*)__pyx_v_colind, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11006  }
11007  __pyx_pybuffernd_colind.diminfo[0].strides = __pyx_pybuffernd_colind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_colind.diminfo[0].shape = __pyx_pybuffernd_colind.rcbuffer->pybuffer.shape[0];
11008  {
11009  __Pyx_BufFmt_StackElem __pyx_stack[1];
11010  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementNeighborsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11011  }
11012  __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[1];
11013  {
11014  __Pyx_BufFmt_StackElem __pyx_stack[1];
11015  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBarycentersArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11016  }
11017  __pyx_pybuffernd_elementBarycentersArray.diminfo[0].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[0].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[1];
11018  {
11019  __Pyx_BufFmt_StackElem __pyx_stack[1];
11020  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11021  }
11022  __pyx_pybuffernd_q_u.diminfo[0].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_u.diminfo[0].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_u.diminfo[1].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_u.diminfo[1].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[1];
11023  {
11024  __Pyx_BufFmt_StackElem __pyx_stack[1];
11025  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11026  }
11027  __pyx_pybuffernd_q_grad_u.diminfo[0].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_u.diminfo[0].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_u.diminfo[1].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_u.diminfo[1].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_u.diminfo[2].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_u.diminfo[2].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[2];
11028  {
11029  __Pyx_BufFmt_StackElem __pyx_stack[1];
11030  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_w, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11031  }
11032  __pyx_pybuffernd_q_grad_w.diminfo[0].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_w.diminfo[0].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_w.diminfo[1].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_w.diminfo[1].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_w.diminfo[2].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_w.diminfo[2].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_q_grad_w.diminfo[3].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_q_grad_w.diminfo[3].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[3];
11033  {
11034  __Pyx_BufFmt_StackElem __pyx_stack[1];
11035  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_detJ, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11036  }
11037  __pyx_pybuffernd_q_detJ.diminfo[0].strides = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_detJ.diminfo[0].shape = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_detJ.diminfo[1].strides = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_detJ.diminfo[1].shape = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.shape[1];
11038  {
11039  __Pyx_BufFmt_StackElem __pyx_stack[1];
11040  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_m, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11041  }
11042  __pyx_pybuffernd_q_m.diminfo[0].strides = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_m.diminfo[0].shape = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_m.diminfo[1].strides = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_m.diminfo[1].shape = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.shape[1];
11043  {
11044  __Pyx_BufFmt_StackElem __pyx_stack[1];
11045  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_mt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11046  }
11047  __pyx_pybuffernd_q_mt.diminfo[0].strides = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_mt.diminfo[0].shape = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_mt.diminfo[1].strides = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_mt.diminfo[1].shape = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.shape[1];
11048  {
11049  __Pyx_BufFmt_StackElem __pyx_stack[1];
11050  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_r, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11051  }
11052  __pyx_pybuffernd_q_r.diminfo[0].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_r.diminfo[0].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_r.diminfo[1].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_r.diminfo[1].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[1];
11053  {
11054  __Pyx_BufFmt_StackElem __pyx_stack[1];
11055  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11056  }
11057  __pyx_pybuffernd_q_kr.diminfo[0].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr.diminfo[0].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr.diminfo[1].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr.diminfo[1].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[1];
11058  {
11059  __Pyx_BufFmt_StackElem __pyx_stack[1];
11060  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr_up, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11061  }
11062  __pyx_pybuffernd_q_kr_up.diminfo[0].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr_up.diminfo[0].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr_up.diminfo[1].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr_up.diminfo[1].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[1];
11063  {
11064  __Pyx_BufFmt_StackElem __pyx_stack[1];
11065  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_flin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11066  }
11067  __pyx_pybuffernd_q_flin.diminfo[0].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_flin.diminfo[0].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_flin.diminfo[1].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_flin.diminfo[1].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_flin.diminfo[2].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_flin.diminfo[2].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[2];
11068  {
11069  __Pyx_BufFmt_StackElem __pyx_stack[1];
11070  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_alin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11071  }
11072  __pyx_pybuffernd_q_alin.diminfo[0].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_alin.diminfo[0].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_alin.diminfo[1].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_alin.diminfo[1].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_alin.diminfo[2].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_alin.diminfo[2].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[2];
11073  {
11074  __Pyx_BufFmt_StackElem __pyx_stack[1];
11075  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementResidual.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementResidual, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11076  }
11077  __pyx_pybuffernd_elementResidual.diminfo[0].strides = __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementResidual.diminfo[0].shape = __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementResidual.diminfo[1].strides = __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementResidual.diminfo[1].shape = __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.shape[1];
11078 
11079  /* "subsurfaceTransportFunctions.pyx":527
11080  *
11081  * """
11082  * cdef int upwindFlag = 1 # <<<<<<<<<<<<<<
11083  * #check some sizes
11084  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
11085  */
11086  __pyx_v_upwindFlag = 1;
11087 
11088  /* "subsurfaceTransportFunctions.pyx":529
11089  * cdef int upwindFlag = 1
11090  * #check some sizes
11091  * for q in [q_u,q_m,q_mt,q_r,q_kr]: # <<<<<<<<<<<<<<
11092  * assert q.shape[1] == nSpace+1
11093  * assert nDOF_test_element == nSpace+1
11094  */
11095  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11096  __Pyx_GOTREF(__pyx_t_1);
11097  __Pyx_INCREF(((PyObject *)__pyx_v_q_u));
11098  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_u));
11099  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_q_u));
11100  __Pyx_INCREF(((PyObject *)__pyx_v_q_m));
11101  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_m));
11102  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_q_m));
11103  __Pyx_INCREF(((PyObject *)__pyx_v_q_mt));
11104  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_mt));
11105  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_q_mt));
11106  __Pyx_INCREF(((PyObject *)__pyx_v_q_r));
11107  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_r));
11108  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_q_r));
11109  __Pyx_INCREF(((PyObject *)__pyx_v_q_kr));
11110  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_kr));
11111  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_q_kr));
11112  __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
11113  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11114  for (;;) {
11115  if (__pyx_t_3 >= 5) break;
11116  #if CYTHON_COMPILING_IN_CPYTHON
11117  __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11118  #else
11119  __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11120  __Pyx_GOTREF(__pyx_t_1);
11121  #endif
11122  __Pyx_XDECREF_SET(__pyx_v_q, __pyx_t_1);
11123  __pyx_t_1 = 0;
11124 
11125  /* "subsurfaceTransportFunctions.pyx":530
11126  * #check some sizes
11127  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
11128  * assert q.shape[1] == nSpace+1 # <<<<<<<<<<<<<<
11129  * assert nDOF_test_element == nSpace+1
11130  * cdef int nnz = rowptr[nSpace]
11131  */
11132  #ifndef CYTHON_WITHOUT_ASSERTIONS
11133  if (unlikely(!Py_OptimizeFlag)) {
11134  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_q, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11135  __Pyx_GOTREF(__pyx_t_1);
11136  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
11137  __Pyx_GOTREF(__pyx_t_4);
11138  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11139  __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_nSpace + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11140  __Pyx_GOTREF(__pyx_t_1);
11141  __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11142  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11143  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11144  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11145  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11146  if (unlikely(!__pyx_t_6)) {
11147  PyErr_SetNone(PyExc_AssertionError);
11148  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11149  }
11150  }
11151  #endif
11152 
11153  /* "subsurfaceTransportFunctions.pyx":529
11154  * cdef int upwindFlag = 1
11155  * #check some sizes
11156  * for q in [q_u,q_m,q_mt,q_r,q_kr]: # <<<<<<<<<<<<<<
11157  * assert q.shape[1] == nSpace+1
11158  * assert nDOF_test_element == nSpace+1
11159  */
11160  }
11161  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11162 
11163  /* "subsurfaceTransportFunctions.pyx":531
11164  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
11165  * assert q.shape[1] == nSpace+1
11166  * assert nDOF_test_element == nSpace+1 # <<<<<<<<<<<<<<
11167  * cdef int nnz = rowptr[nSpace]
11168  * #temporaries
11169  */
11170  #ifndef CYTHON_WITHOUT_ASSERTIONS
11171  if (unlikely(!Py_OptimizeFlag)) {
11172  if (unlikely(!((__pyx_v_nDOF_test_element == (__pyx_v_nSpace + 1)) != 0))) {
11173  PyErr_SetNone(PyExc_AssertionError);
11174  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11175  }
11176  }
11177  #endif
11178 
11179  /* "subsurfaceTransportFunctions.pyx":532
11180  * assert q.shape[1] == nSpace+1
11181  * assert nDOF_test_element == nSpace+1
11182  * cdef int nnz = rowptr[nSpace] # <<<<<<<<<<<<<<
11183  * #temporaries
11184  * cdef double u_eN,kr_eN,phi_eN,u_neig,kr_neig,phi_neig
11185  */
11186  __pyx_t_7 = __pyx_v_nSpace;
11187  __pyx_t_8 = -1;
11188  if (__pyx_t_7 < 0) {
11189  __pyx_t_7 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
11190  if (unlikely(__pyx_t_7 < 0)) __pyx_t_8 = 0;
11191  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_8 = 0;
11192  if (unlikely(__pyx_t_8 != -1)) {
11193  __Pyx_RaiseBufferIndexError(__pyx_t_8);
11194  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11195  }
11196  __pyx_v_nnz = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_rowptr.diminfo[0].strides));
11197 
11198  /* "subsurfaceTransportFunctions.pyx":536
11199  * cdef double u_eN,kr_eN,phi_eN,u_neig,kr_neig,phi_neig
11200  * cdef int eN,eN_neighbor,ii,I,i,ebN
11201  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_up= numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
11202  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d')
11203  * #for averaging/integration weights
11204  */
11205  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11206  __Pyx_GOTREF(__pyx_t_5);
11207  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11208  __Pyx_GOTREF(__pyx_t_1);
11209  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11210  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11211  __Pyx_GOTREF(__pyx_t_5);
11212  __pyx_t_4 = NULL;
11213  __pyx_t_3 = 0;
11214  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
11215  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
11216  if (likely(__pyx_t_4)) {
11217  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
11218  __Pyx_INCREF(__pyx_t_4);
11219  __Pyx_INCREF(function);
11220  __Pyx_DECREF_SET(__pyx_t_1, function);
11221  __pyx_t_3 = 1;
11222  }
11223  }
11224  __pyx_t_9 = PyTuple_New(2+__pyx_t_3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11225  __Pyx_GOTREF(__pyx_t_9);
11226  if (__pyx_t_4) {
11227  __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __pyx_t_4 = NULL;
11228  }
11229  __Pyx_GIVEREF(__pyx_t_5);
11230  PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_3, __pyx_t_5);
11231  __Pyx_INCREF(__pyx_n_s_d);
11232  __Pyx_GIVEREF(__pyx_n_s_d);
11233  PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_3, __pyx_n_s_d);
11234  __pyx_t_5 = 0;
11235  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11236  __Pyx_GOTREF(__pyx_t_2);
11237  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
11238  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11239  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11240  __pyx_t_10 = ((PyArrayObject *)__pyx_t_2);
11241  {
11242  __Pyx_BufFmt_StackElem __pyx_stack[1];
11243  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
11244  __pyx_v_a_up = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf = NULL;
11245  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11246  } else {__pyx_pybuffernd_a_up.diminfo[0].strides = __pyx_pybuffernd_a_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_up.diminfo[0].shape = __pyx_pybuffernd_a_up.rcbuffer->pybuffer.shape[0];
11247  }
11248  }
11249  __pyx_t_10 = 0;
11250  __pyx_v_a_up = ((PyArrayObject *)__pyx_t_2);
11251  __pyx_t_2 = 0;
11252 
11253  /* "subsurfaceTransportFunctions.pyx":537
11254  * cdef int eN,eN_neighbor,ii,I,i,ebN
11255  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_up= numpy.zeros(nnz,'d')
11256  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d') # <<<<<<<<<<<<<<
11257  * #for averaging/integration weights
11258  * cdef double nAvgWeight = 1.0/(nSpace+1.)
11259  */
11260  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11261  __Pyx_GOTREF(__pyx_t_1);
11262  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11263  __Pyx_GOTREF(__pyx_t_9);
11264  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11265  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_nSpace); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11266  __Pyx_GOTREF(__pyx_t_1);
11267  __pyx_t_5 = NULL;
11268  __pyx_t_3 = 0;
11269  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_9))) {
11270  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9);
11271  if (likely(__pyx_t_5)) {
11272  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
11273  __Pyx_INCREF(__pyx_t_5);
11274  __Pyx_INCREF(function);
11275  __Pyx_DECREF_SET(__pyx_t_9, function);
11276  __pyx_t_3 = 1;
11277  }
11278  }
11279  __pyx_t_4 = PyTuple_New(2+__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11280  __Pyx_GOTREF(__pyx_t_4);
11281  if (__pyx_t_5) {
11282  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
11283  }
11284  __Pyx_GIVEREF(__pyx_t_1);
11285  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_3, __pyx_t_1);
11286  __Pyx_INCREF(__pyx_n_s_d);
11287  __Pyx_GIVEREF(__pyx_n_s_d);
11288  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_3, __pyx_n_s_d);
11289  __pyx_t_1 = 0;
11290  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11291  __Pyx_GOTREF(__pyx_t_2);
11292  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11293  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
11294  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11295  __pyx_t_11 = ((PyArrayObject *)__pyx_t_2);
11296  {
11297  __Pyx_BufFmt_StackElem __pyx_stack[1];
11298  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
11299  __pyx_v_f_up = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf = NULL;
11300  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11301  } else {__pyx_pybuffernd_f_up.diminfo[0].strides = __pyx_pybuffernd_f_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_f_up.diminfo[0].shape = __pyx_pybuffernd_f_up.rcbuffer->pybuffer.shape[0];
11302  }
11303  }
11304  __pyx_t_11 = 0;
11305  __pyx_v_f_up = ((PyArrayObject *)__pyx_t_2);
11306  __pyx_t_2 = 0;
11307 
11308  /* "subsurfaceTransportFunctions.pyx":539
11309  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d')
11310  * #for averaging/integration weights
11311  * cdef double nAvgWeight = 1.0/(nSpace+1.) # <<<<<<<<<<<<<<
11312  * cdef double weight=1.0,volFactor = 1.0
11313  * if nSpace == 2:
11314  */
11315  __pyx_t_12 = (__pyx_v_nSpace + 1.);
11316  if (unlikely(__pyx_t_12 == 0)) {
11317  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
11318  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11319  }
11320  __pyx_v_nAvgWeight = (1.0 / __pyx_t_12);
11321 
11322  /* "subsurfaceTransportFunctions.pyx":540
11323  * #for averaging/integration weights
11324  * cdef double nAvgWeight = 1.0/(nSpace+1.)
11325  * cdef double weight=1.0,volFactor = 1.0 # <<<<<<<<<<<<<<
11326  * if nSpace == 2:
11327  * volFactor = 0.5
11328  */
11329  __pyx_v_weight = 1.0;
11330  __pyx_v_volFactor = 1.0;
11331 
11332  /* "subsurfaceTransportFunctions.pyx":541
11333  * cdef double nAvgWeight = 1.0/(nSpace+1.)
11334  * cdef double weight=1.0,volFactor = 1.0
11335  * if nSpace == 2: # <<<<<<<<<<<<<<
11336  * volFactor = 0.5
11337  * if nSpace == 3:
11338  */
11339  __pyx_t_6 = ((__pyx_v_nSpace == 2) != 0);
11340  if (__pyx_t_6) {
11341 
11342  /* "subsurfaceTransportFunctions.pyx":542
11343  * cdef double weight=1.0,volFactor = 1.0
11344  * if nSpace == 2:
11345  * volFactor = 0.5 # <<<<<<<<<<<<<<
11346  * if nSpace == 3:
11347  * volFactor = 1.0/6.0
11348  */
11349  __pyx_v_volFactor = 0.5;
11350 
11351  /* "subsurfaceTransportFunctions.pyx":541
11352  * cdef double nAvgWeight = 1.0/(nSpace+1.)
11353  * cdef double weight=1.0,volFactor = 1.0
11354  * if nSpace == 2: # <<<<<<<<<<<<<<
11355  * volFactor = 0.5
11356  * if nSpace == 3:
11357  */
11358  }
11359 
11360  /* "subsurfaceTransportFunctions.pyx":543
11361  * if nSpace == 2:
11362  * volFactor = 0.5
11363  * if nSpace == 3: # <<<<<<<<<<<<<<
11364  * volFactor = 1.0/6.0
11365  * #
11366  */
11367  __pyx_t_6 = ((__pyx_v_nSpace == 3) != 0);
11368  if (__pyx_t_6) {
11369 
11370  /* "subsurfaceTransportFunctions.pyx":544
11371  * volFactor = 0.5
11372  * if nSpace == 3:
11373  * volFactor = 1.0/6.0 # <<<<<<<<<<<<<<
11374  * #
11375  * for eN in range(nElements_global):
11376  */
11377  __pyx_v_volFactor = (1.0 / 6.0);
11378 
11379  /* "subsurfaceTransportFunctions.pyx":543
11380  * if nSpace == 2:
11381  * volFactor = 0.5
11382  * if nSpace == 3: # <<<<<<<<<<<<<<
11383  * volFactor = 1.0/6.0
11384  * #
11385  */
11386  }
11387 
11388  /* "subsurfaceTransportFunctions.pyx":546
11389  * volFactor = 1.0/6.0
11390  * #
11391  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
11392  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation
11393  * weight = nAvgWeight*volume
11394  */
11395  __pyx_t_8 = __pyx_v_nElements_global;
11396  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_8; __pyx_t_13+=1) {
11397  __pyx_v_eN = __pyx_t_13;
11398 
11399  /* "subsurfaceTransportFunctions.pyx":547
11400  * #
11401  * for eN in range(nElements_global):
11402  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation # <<<<<<<<<<<<<<
11403  * weight = nAvgWeight*volume
11404  *
11405  */
11406  __pyx_t_14 = __pyx_v_eN;
11407  __pyx_t_15 = 0;
11408  __pyx_t_16 = -1;
11409  if (__pyx_t_14 < 0) {
11410  __pyx_t_14 += __pyx_pybuffernd_q_detJ.diminfo[0].shape;
11411  if (unlikely(__pyx_t_14 < 0)) __pyx_t_16 = 0;
11412  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_q_detJ.diminfo[0].shape)) __pyx_t_16 = 0;
11413  if (__pyx_t_15 < 0) {
11414  __pyx_t_15 += __pyx_pybuffernd_q_detJ.diminfo[1].shape;
11415  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 1;
11416  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_detJ.diminfo[1].shape)) __pyx_t_16 = 1;
11417  if (unlikely(__pyx_t_16 != -1)) {
11418  __Pyx_RaiseBufferIndexError(__pyx_t_16);
11419  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11420  }
11421  __pyx_v_volume = (__pyx_v_volFactor * fabs((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_q_detJ.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_detJ.diminfo[1].strides))));
11422 
11423  /* "subsurfaceTransportFunctions.pyx":548
11424  * for eN in range(nElements_global):
11425  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation
11426  * weight = nAvgWeight*volume # <<<<<<<<<<<<<<
11427  *
11428  * for i in range(nDOF_test_element):
11429  */
11430  __pyx_v_weight = (__pyx_v_nAvgWeight * __pyx_v_volume);
11431 
11432  /* "subsurfaceTransportFunctions.pyx":550
11433  * weight = nAvgWeight*volume
11434  *
11435  * for i in range(nDOF_test_element): # <<<<<<<<<<<<<<
11436  * #nodal quadrature so diagonal
11437  * ##mass
11438  */
11439  __pyx_t_16 = __pyx_v_nDOF_test_element;
11440  for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
11441  __pyx_v_i = __pyx_t_17;
11442 
11443  /* "subsurfaceTransportFunctions.pyx":553
11444  * #nodal quadrature so diagonal
11445  * ##mass
11446  * elementResidual[eN,i] += weight*q_mt[eN,i] # <<<<<<<<<<<<<<
11447  * ##sources
11448  * elementResidual[eN,i] += weight*q_r[eN,i]
11449  */
11450  __pyx_t_18 = __pyx_v_eN;
11451  __pyx_t_19 = __pyx_v_i;
11452  __pyx_t_20 = -1;
11453  if (__pyx_t_18 < 0) {
11454  __pyx_t_18 += __pyx_pybuffernd_q_mt.diminfo[0].shape;
11455  if (unlikely(__pyx_t_18 < 0)) __pyx_t_20 = 0;
11456  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_q_mt.diminfo[0].shape)) __pyx_t_20 = 0;
11457  if (__pyx_t_19 < 0) {
11458  __pyx_t_19 += __pyx_pybuffernd_q_mt.diminfo[1].shape;
11459  if (unlikely(__pyx_t_19 < 0)) __pyx_t_20 = 1;
11460  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_q_mt.diminfo[1].shape)) __pyx_t_20 = 1;
11461  if (unlikely(__pyx_t_20 != -1)) {
11462  __Pyx_RaiseBufferIndexError(__pyx_t_20);
11463  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11464  }
11465  __pyx_t_21 = __pyx_v_eN;
11466  __pyx_t_22 = __pyx_v_i;
11467  __pyx_t_20 = -1;
11468  if (__pyx_t_21 < 0) {
11469  __pyx_t_21 += __pyx_pybuffernd_elementResidual.diminfo[0].shape;
11470  if (unlikely(__pyx_t_21 < 0)) __pyx_t_20 = 0;
11471  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_elementResidual.diminfo[0].shape)) __pyx_t_20 = 0;
11472  if (__pyx_t_22 < 0) {
11473  __pyx_t_22 += __pyx_pybuffernd_elementResidual.diminfo[1].shape;
11474  if (unlikely(__pyx_t_22 < 0)) __pyx_t_20 = 1;
11475  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_elementResidual.diminfo[1].shape)) __pyx_t_20 = 1;
11476  if (unlikely(__pyx_t_20 != -1)) {
11477  __Pyx_RaiseBufferIndexError(__pyx_t_20);
11478  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11479  }
11480  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_elementResidual.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_elementResidual.diminfo[1].strides) += (__pyx_v_weight * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_q_mt.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_q_mt.diminfo[1].strides)));
11481 
11482  /* "subsurfaceTransportFunctions.pyx":555
11483  * elementResidual[eN,i] += weight*q_mt[eN,i]
11484  * ##sources
11485  * elementResidual[eN,i] += weight*q_r[eN,i] # <<<<<<<<<<<<<<
11486  *
11487  * #have to actually compute loop over other nodes for stiffness terms
11488  */
11489  __pyx_t_23 = __pyx_v_eN;
11490  __pyx_t_24 = __pyx_v_i;
11491  __pyx_t_20 = -1;
11492  if (__pyx_t_23 < 0) {
11493  __pyx_t_23 += __pyx_pybuffernd_q_r.diminfo[0].shape;
11494  if (unlikely(__pyx_t_23 < 0)) __pyx_t_20 = 0;
11495  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_q_r.diminfo[0].shape)) __pyx_t_20 = 0;
11496  if (__pyx_t_24 < 0) {
11497  __pyx_t_24 += __pyx_pybuffernd_q_r.diminfo[1].shape;
11498  if (unlikely(__pyx_t_24 < 0)) __pyx_t_20 = 1;
11499  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_q_r.diminfo[1].shape)) __pyx_t_20 = 1;
11500  if (unlikely(__pyx_t_20 != -1)) {
11501  __Pyx_RaiseBufferIndexError(__pyx_t_20);
11502  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11503  }
11504  __pyx_t_25 = __pyx_v_eN;
11505  __pyx_t_26 = __pyx_v_i;
11506  __pyx_t_20 = -1;
11507  if (__pyx_t_25 < 0) {
11508  __pyx_t_25 += __pyx_pybuffernd_elementResidual.diminfo[0].shape;
11509  if (unlikely(__pyx_t_25 < 0)) __pyx_t_20 = 0;
11510  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_elementResidual.diminfo[0].shape)) __pyx_t_20 = 0;
11511  if (__pyx_t_26 < 0) {
11512  __pyx_t_26 += __pyx_pybuffernd_elementResidual.diminfo[1].shape;
11513  if (unlikely(__pyx_t_26 < 0)) __pyx_t_20 = 1;
11514  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_elementResidual.diminfo[1].shape)) __pyx_t_20 = 1;
11515  if (unlikely(__pyx_t_20 != -1)) {
11516  __Pyx_RaiseBufferIndexError(__pyx_t_20);
11517  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11518  }
11519  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_elementResidual.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_elementResidual.diminfo[1].strides) += (__pyx_v_weight * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_r.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_q_r.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_q_r.diminfo[1].strides)));
11520 
11521  /* "subsurfaceTransportFunctions.pyx":558
11522  *
11523  * #have to actually compute loop over other nodes for stiffness terms
11524  * for ebN in range(nElementBoundaries_element): #same as nDOF_trial , nElementBoundaries_ # <<<<<<<<<<<<<<
11525  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
11526  * for ii in range(nnz):
11527  */
11528  __pyx_t_20 = __pyx_v_nElementBoundaries_element;
11529  for (__pyx_t_27 = 0; __pyx_t_27 < __pyx_t_20; __pyx_t_27+=1) {
11530  __pyx_v_ebN = __pyx_t_27;
11531 
11532  /* "subsurfaceTransportFunctions.pyx":560
11533  * for ebN in range(nElementBoundaries_element): #same as nDOF_trial , nElementBoundaries_
11534  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
11535  * for ii in range(nnz): # <<<<<<<<<<<<<<
11536  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
11537  * for I in range(nSpace):
11538  */
11539  __pyx_t_28 = __pyx_v_nnz;
11540  for (__pyx_t_29 = 0; __pyx_t_29 < __pyx_t_28; __pyx_t_29+=1) {
11541  __pyx_v_ii = __pyx_t_29;
11542 
11543  /* "subsurfaceTransportFunctions.pyx":561
11544  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
11545  * for ii in range(nnz):
11546  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN] # <<<<<<<<<<<<<<
11547  * for I in range(nSpace):
11548  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN]
11549  */
11550  __pyx_t_30 = __pyx_v_eN;
11551  __pyx_t_31 = __pyx_v_ebN;
11552  __pyx_t_32 = __pyx_v_ii;
11553  __pyx_t_33 = -1;
11554  if (__pyx_t_30 < 0) {
11555  __pyx_t_30 += __pyx_pybuffernd_q_alin.diminfo[0].shape;
11556  if (unlikely(__pyx_t_30 < 0)) __pyx_t_33 = 0;
11557  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_q_alin.diminfo[0].shape)) __pyx_t_33 = 0;
11558  if (__pyx_t_31 < 0) {
11559  __pyx_t_31 += __pyx_pybuffernd_q_alin.diminfo[1].shape;
11560  if (unlikely(__pyx_t_31 < 0)) __pyx_t_33 = 1;
11561  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_q_alin.diminfo[1].shape)) __pyx_t_33 = 1;
11562  if (__pyx_t_32 < 0) {
11563  __pyx_t_32 += __pyx_pybuffernd_q_alin.diminfo[2].shape;
11564  if (unlikely(__pyx_t_32 < 0)) __pyx_t_33 = 2;
11565  } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_q_alin.diminfo[2].shape)) __pyx_t_33 = 2;
11566  if (unlikely(__pyx_t_33 != -1)) {
11567  __Pyx_RaiseBufferIndexError(__pyx_t_33);
11568  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11569  }
11570  __pyx_t_34 = __pyx_v_eN;
11571  __pyx_t_35 = __pyx_v_ebN;
11572  __pyx_t_33 = -1;
11573  if (__pyx_t_34 < 0) {
11574  __pyx_t_34 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
11575  if (unlikely(__pyx_t_34 < 0)) __pyx_t_33 = 0;
11576  } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_33 = 0;
11577  if (__pyx_t_35 < 0) {
11578  __pyx_t_35 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
11579  if (unlikely(__pyx_t_35 < 0)) __pyx_t_33 = 1;
11580  } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_33 = 1;
11581  if (unlikely(__pyx_t_33 != -1)) {
11582  __Pyx_RaiseBufferIndexError(__pyx_t_33);
11583  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11584  }
11585  __pyx_t_36 = __pyx_v_ii;
11586  __pyx_t_33 = -1;
11587  if (__pyx_t_36 < 0) {
11588  __pyx_t_36 += __pyx_pybuffernd_a_up.diminfo[0].shape;
11589  if (unlikely(__pyx_t_36 < 0)) __pyx_t_33 = 0;
11590  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_a_up.diminfo[0].shape)) __pyx_t_33 = 0;
11591  if (unlikely(__pyx_t_33 != -1)) {
11592  __Pyx_RaiseBufferIndexError(__pyx_t_33);
11593  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11594  }
11595  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_a_up.diminfo[0].strides) = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_q_alin.diminfo[0].strides, __pyx_t_31, __pyx_pybuffernd_q_alin.diminfo[1].strides, __pyx_t_32, __pyx_pybuffernd_q_alin.diminfo[2].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_q_kr_up.diminfo[1].strides)));
11596  }
11597 
11598  /* "subsurfaceTransportFunctions.pyx":562
11599  * for ii in range(nnz):
11600  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
11601  * for I in range(nSpace): # <<<<<<<<<<<<<<
11602  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN]
11603  * #
11604  */
11605  __pyx_t_28 = __pyx_v_nSpace;
11606  for (__pyx_t_29 = 0; __pyx_t_29 < __pyx_t_28; __pyx_t_29+=1) {
11607  __pyx_v_I = __pyx_t_29;
11608 
11609  /* "subsurfaceTransportFunctions.pyx":563
11610  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
11611  * for I in range(nSpace):
11612  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN] # <<<<<<<<<<<<<<
11613  * #
11614  * #accumulate advection and stiffness contributions
11615  */
11616  __pyx_t_37 = __pyx_v_eN;
11617  __pyx_t_38 = __pyx_v_ebN;
11618  __pyx_t_39 = __pyx_v_I;
11619  __pyx_t_33 = -1;
11620  if (__pyx_t_37 < 0) {
11621  __pyx_t_37 += __pyx_pybuffernd_q_flin.diminfo[0].shape;
11622  if (unlikely(__pyx_t_37 < 0)) __pyx_t_33 = 0;
11623  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_q_flin.diminfo[0].shape)) __pyx_t_33 = 0;
11624  if (__pyx_t_38 < 0) {
11625  __pyx_t_38 += __pyx_pybuffernd_q_flin.diminfo[1].shape;
11626  if (unlikely(__pyx_t_38 < 0)) __pyx_t_33 = 1;
11627  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_q_flin.diminfo[1].shape)) __pyx_t_33 = 1;
11628  if (__pyx_t_39 < 0) {
11629  __pyx_t_39 += __pyx_pybuffernd_q_flin.diminfo[2].shape;
11630  if (unlikely(__pyx_t_39 < 0)) __pyx_t_33 = 2;
11631  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_q_flin.diminfo[2].shape)) __pyx_t_33 = 2;
11632  if (unlikely(__pyx_t_33 != -1)) {
11633  __Pyx_RaiseBufferIndexError(__pyx_t_33);
11634  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11635  }
11636  __pyx_t_40 = __pyx_v_eN;
11637  __pyx_t_41 = __pyx_v_ebN;
11638  __pyx_t_33 = -1;
11639  if (__pyx_t_40 < 0) {
11640  __pyx_t_40 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
11641  if (unlikely(__pyx_t_40 < 0)) __pyx_t_33 = 0;
11642  } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_33 = 0;
11643  if (__pyx_t_41 < 0) {
11644  __pyx_t_41 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
11645  if (unlikely(__pyx_t_41 < 0)) __pyx_t_33 = 1;
11646  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_33 = 1;
11647  if (unlikely(__pyx_t_33 != -1)) {
11648  __Pyx_RaiseBufferIndexError(__pyx_t_33);
11649  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11650  }
11651  __pyx_t_42 = __pyx_v_I;
11652  __pyx_t_33 = -1;
11653  if (__pyx_t_42 < 0) {
11654  __pyx_t_42 += __pyx_pybuffernd_f_up.diminfo[0].shape;
11655  if (unlikely(__pyx_t_42 < 0)) __pyx_t_33 = 0;
11656  } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_f_up.diminfo[0].shape)) __pyx_t_33 = 0;
11657  if (unlikely(__pyx_t_33 != -1)) {
11658  __Pyx_RaiseBufferIndexError(__pyx_t_33);
11659  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11660  }
11661  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_f_up.diminfo[0].strides) = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_q_flin.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_q_flin.diminfo[1].strides, __pyx_t_39, __pyx_pybuffernd_q_flin.diminfo[2].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_41, __pyx_pybuffernd_q_kr_up.diminfo[1].strides)));
11662  }
11663 
11664  /* "subsurfaceTransportFunctions.pyx":566
11665  * #
11666  * #accumulate advection and stiffness contributions
11667  * for I in range(nSpace): # <<<<<<<<<<<<<<
11668  * elementResidual[eN,i] -= weight*f_up[I]*q_grad_w[eN,ebN,i,I]
11669  * for ii in range(rowptr[I],rowptr[I+1]):
11670  */
11671  __pyx_t_28 = __pyx_v_nSpace;
11672  for (__pyx_t_29 = 0; __pyx_t_29 < __pyx_t_28; __pyx_t_29+=1) {
11673  __pyx_v_I = __pyx_t_29;
11674 
11675  /* "subsurfaceTransportFunctions.pyx":567
11676  * #accumulate advection and stiffness contributions
11677  * for I in range(nSpace):
11678  * elementResidual[eN,i] -= weight*f_up[I]*q_grad_w[eN,ebN,i,I] # <<<<<<<<<<<<<<
11679  * for ii in range(rowptr[I],rowptr[I+1]):
11680  * elementResidual[eN,i] += weight*a_up[ii]*q_grad_u[eN,ebN,colind[ii]]*q_grad_w[eN,ebN,i,I]
11681  */
11682  __pyx_t_43 = __pyx_v_I;
11683  __pyx_t_33 = -1;
11684  if (__pyx_t_43 < 0) {
11685  __pyx_t_43 += __pyx_pybuffernd_f_up.diminfo[0].shape;
11686  if (unlikely(__pyx_t_43 < 0)) __pyx_t_33 = 0;
11687  } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_f_up.diminfo[0].shape)) __pyx_t_33 = 0;
11688  if (unlikely(__pyx_t_33 != -1)) {
11689  __Pyx_RaiseBufferIndexError(__pyx_t_33);
11690  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11691  }
11692  __pyx_t_44 = __pyx_v_eN;
11693  __pyx_t_45 = __pyx_v_ebN;
11694  __pyx_t_46 = __pyx_v_i;
11695  __pyx_t_47 = __pyx_v_I;
11696  __pyx_t_33 = -1;
11697  if (__pyx_t_44 < 0) {
11698  __pyx_t_44 += __pyx_pybuffernd_q_grad_w.diminfo[0].shape;
11699  if (unlikely(__pyx_t_44 < 0)) __pyx_t_33 = 0;
11700  } else if (unlikely(__pyx_t_44 >= __pyx_pybuffernd_q_grad_w.diminfo[0].shape)) __pyx_t_33 = 0;
11701  if (__pyx_t_45 < 0) {
11702  __pyx_t_45 += __pyx_pybuffernd_q_grad_w.diminfo[1].shape;
11703  if (unlikely(__pyx_t_45 < 0)) __pyx_t_33 = 1;
11704  } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_q_grad_w.diminfo[1].shape)) __pyx_t_33 = 1;
11705  if (__pyx_t_46 < 0) {
11706  __pyx_t_46 += __pyx_pybuffernd_q_grad_w.diminfo[2].shape;
11707  if (unlikely(__pyx_t_46 < 0)) __pyx_t_33 = 2;
11708  } else if (unlikely(__pyx_t_46 >= __pyx_pybuffernd_q_grad_w.diminfo[2].shape)) __pyx_t_33 = 2;
11709  if (__pyx_t_47 < 0) {
11710  __pyx_t_47 += __pyx_pybuffernd_q_grad_w.diminfo[3].shape;
11711  if (unlikely(__pyx_t_47 < 0)) __pyx_t_33 = 3;
11712  } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_q_grad_w.diminfo[3].shape)) __pyx_t_33 = 3;
11713  if (unlikely(__pyx_t_33 != -1)) {
11714  __Pyx_RaiseBufferIndexError(__pyx_t_33);
11715  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11716  }
11717  __pyx_t_48 = __pyx_v_eN;
11718  __pyx_t_49 = __pyx_v_i;
11719  __pyx_t_33 = -1;
11720  if (__pyx_t_48 < 0) {
11721  __pyx_t_48 += __pyx_pybuffernd_elementResidual.diminfo[0].shape;
11722  if (unlikely(__pyx_t_48 < 0)) __pyx_t_33 = 0;
11723  } else if (unlikely(__pyx_t_48 >= __pyx_pybuffernd_elementResidual.diminfo[0].shape)) __pyx_t_33 = 0;
11724  if (__pyx_t_49 < 0) {
11725  __pyx_t_49 += __pyx_pybuffernd_elementResidual.diminfo[1].shape;
11726  if (unlikely(__pyx_t_49 < 0)) __pyx_t_33 = 1;
11727  } else if (unlikely(__pyx_t_49 >= __pyx_pybuffernd_elementResidual.diminfo[1].shape)) __pyx_t_33 = 1;
11728  if (unlikely(__pyx_t_33 != -1)) {
11729  __Pyx_RaiseBufferIndexError(__pyx_t_33);
11730  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11731  }
11732  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_elementResidual.diminfo[0].strides, __pyx_t_49, __pyx_pybuffernd_elementResidual.diminfo[1].strides) -= ((__pyx_v_weight * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_f_up.diminfo[0].strides))) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_q_grad_w.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_q_grad_w.diminfo[1].strides, __pyx_t_46, __pyx_pybuffernd_q_grad_w.diminfo[2].strides, __pyx_t_47, __pyx_pybuffernd_q_grad_w.diminfo[3].strides)));
11733 
11734  /* "subsurfaceTransportFunctions.pyx":568
11735  * for I in range(nSpace):
11736  * elementResidual[eN,i] -= weight*f_up[I]*q_grad_w[eN,ebN,i,I]
11737  * for ii in range(rowptr[I],rowptr[I+1]): # <<<<<<<<<<<<<<
11738  * elementResidual[eN,i] += weight*a_up[ii]*q_grad_u[eN,ebN,colind[ii]]*q_grad_w[eN,ebN,i,I]
11739  * #I
11740  */
11741  __pyx_t_50 = (__pyx_v_I + 1);
11742  __pyx_t_33 = -1;
11743  if (__pyx_t_50 < 0) {
11744  __pyx_t_50 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
11745  if (unlikely(__pyx_t_50 < 0)) __pyx_t_33 = 0;
11746  } else if (unlikely(__pyx_t_50 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_33 = 0;
11747  if (unlikely(__pyx_t_33 != -1)) {
11748  __Pyx_RaiseBufferIndexError(__pyx_t_33);
11749  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11750  }
11751  __pyx_t_51 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_50, __pyx_pybuffernd_rowptr.diminfo[0].strides));
11752  __pyx_t_52 = __pyx_v_I;
11753  __pyx_t_33 = -1;
11754  if (__pyx_t_52 < 0) {
11755  __pyx_t_52 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
11756  if (unlikely(__pyx_t_52 < 0)) __pyx_t_33 = 0;
11757  } else if (unlikely(__pyx_t_52 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_33 = 0;
11758  if (unlikely(__pyx_t_33 != -1)) {
11759  __Pyx_RaiseBufferIndexError(__pyx_t_33);
11760  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11761  }
11762  for (__pyx_t_33 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_52, __pyx_pybuffernd_rowptr.diminfo[0].strides)); __pyx_t_33 < __pyx_t_51; __pyx_t_33+=1) {
11763  __pyx_v_ii = __pyx_t_33;
11764 
11765  /* "subsurfaceTransportFunctions.pyx":569
11766  * elementResidual[eN,i] -= weight*f_up[I]*q_grad_w[eN,ebN,i,I]
11767  * for ii in range(rowptr[I],rowptr[I+1]):
11768  * elementResidual[eN,i] += weight*a_up[ii]*q_grad_u[eN,ebN,colind[ii]]*q_grad_w[eN,ebN,i,I] # <<<<<<<<<<<<<<
11769  * #I
11770  * #j
11771  */
11772  __pyx_t_53 = __pyx_v_ii;
11773  __pyx_t_54 = -1;
11774  if (__pyx_t_53 < 0) {
11775  __pyx_t_53 += __pyx_pybuffernd_a_up.diminfo[0].shape;
11776  if (unlikely(__pyx_t_53 < 0)) __pyx_t_54 = 0;
11777  } else if (unlikely(__pyx_t_53 >= __pyx_pybuffernd_a_up.diminfo[0].shape)) __pyx_t_54 = 0;
11778  if (unlikely(__pyx_t_54 != -1)) {
11779  __Pyx_RaiseBufferIndexError(__pyx_t_54);
11780  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11781  }
11782  __pyx_t_55 = __pyx_v_ii;
11783  __pyx_t_54 = -1;
11784  if (__pyx_t_55 < 0) {
11785  __pyx_t_55 += __pyx_pybuffernd_colind.diminfo[0].shape;
11786  if (unlikely(__pyx_t_55 < 0)) __pyx_t_54 = 0;
11787  } else if (unlikely(__pyx_t_55 >= __pyx_pybuffernd_colind.diminfo[0].shape)) __pyx_t_54 = 0;
11788  if (unlikely(__pyx_t_54 != -1)) {
11789  __Pyx_RaiseBufferIndexError(__pyx_t_54);
11790  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11791  }
11792  __pyx_t_56 = __pyx_v_eN;
11793  __pyx_t_57 = __pyx_v_ebN;
11794  __pyx_t_58 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_colind.rcbuffer->pybuffer.buf, __pyx_t_55, __pyx_pybuffernd_colind.diminfo[0].strides));
11795  __pyx_t_54 = -1;
11796  if (__pyx_t_56 < 0) {
11797  __pyx_t_56 += __pyx_pybuffernd_q_grad_u.diminfo[0].shape;
11798  if (unlikely(__pyx_t_56 < 0)) __pyx_t_54 = 0;
11799  } else if (unlikely(__pyx_t_56 >= __pyx_pybuffernd_q_grad_u.diminfo[0].shape)) __pyx_t_54 = 0;
11800  if (__pyx_t_57 < 0) {
11801  __pyx_t_57 += __pyx_pybuffernd_q_grad_u.diminfo[1].shape;
11802  if (unlikely(__pyx_t_57 < 0)) __pyx_t_54 = 1;
11803  } else if (unlikely(__pyx_t_57 >= __pyx_pybuffernd_q_grad_u.diminfo[1].shape)) __pyx_t_54 = 1;
11804  if (__pyx_t_58 < 0) {
11805  __pyx_t_58 += __pyx_pybuffernd_q_grad_u.diminfo[2].shape;
11806  if (unlikely(__pyx_t_58 < 0)) __pyx_t_54 = 2;
11807  } else if (unlikely(__pyx_t_58 >= __pyx_pybuffernd_q_grad_u.diminfo[2].shape)) __pyx_t_54 = 2;
11808  if (unlikely(__pyx_t_54 != -1)) {
11809  __Pyx_RaiseBufferIndexError(__pyx_t_54);
11810  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11811  }
11812  __pyx_t_59 = __pyx_v_eN;
11813  __pyx_t_60 = __pyx_v_ebN;
11814  __pyx_t_61 = __pyx_v_i;
11815  __pyx_t_62 = __pyx_v_I;
11816  __pyx_t_54 = -1;
11817  if (__pyx_t_59 < 0) {
11818  __pyx_t_59 += __pyx_pybuffernd_q_grad_w.diminfo[0].shape;
11819  if (unlikely(__pyx_t_59 < 0)) __pyx_t_54 = 0;
11820  } else if (unlikely(__pyx_t_59 >= __pyx_pybuffernd_q_grad_w.diminfo[0].shape)) __pyx_t_54 = 0;
11821  if (__pyx_t_60 < 0) {
11822  __pyx_t_60 += __pyx_pybuffernd_q_grad_w.diminfo[1].shape;
11823  if (unlikely(__pyx_t_60 < 0)) __pyx_t_54 = 1;
11824  } else if (unlikely(__pyx_t_60 >= __pyx_pybuffernd_q_grad_w.diminfo[1].shape)) __pyx_t_54 = 1;
11825  if (__pyx_t_61 < 0) {
11826  __pyx_t_61 += __pyx_pybuffernd_q_grad_w.diminfo[2].shape;
11827  if (unlikely(__pyx_t_61 < 0)) __pyx_t_54 = 2;
11828  } else if (unlikely(__pyx_t_61 >= __pyx_pybuffernd_q_grad_w.diminfo[2].shape)) __pyx_t_54 = 2;
11829  if (__pyx_t_62 < 0) {
11830  __pyx_t_62 += __pyx_pybuffernd_q_grad_w.diminfo[3].shape;
11831  if (unlikely(__pyx_t_62 < 0)) __pyx_t_54 = 3;
11832  } else if (unlikely(__pyx_t_62 >= __pyx_pybuffernd_q_grad_w.diminfo[3].shape)) __pyx_t_54 = 3;
11833  if (unlikely(__pyx_t_54 != -1)) {
11834  __Pyx_RaiseBufferIndexError(__pyx_t_54);
11835  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11836  }
11837  __pyx_t_63 = __pyx_v_eN;
11838  __pyx_t_64 = __pyx_v_i;
11839  __pyx_t_54 = -1;
11840  if (__pyx_t_63 < 0) {
11841  __pyx_t_63 += __pyx_pybuffernd_elementResidual.diminfo[0].shape;
11842  if (unlikely(__pyx_t_63 < 0)) __pyx_t_54 = 0;
11843  } else if (unlikely(__pyx_t_63 >= __pyx_pybuffernd_elementResidual.diminfo[0].shape)) __pyx_t_54 = 0;
11844  if (__pyx_t_64 < 0) {
11845  __pyx_t_64 += __pyx_pybuffernd_elementResidual.diminfo[1].shape;
11846  if (unlikely(__pyx_t_64 < 0)) __pyx_t_54 = 1;
11847  } else if (unlikely(__pyx_t_64 >= __pyx_pybuffernd_elementResidual.diminfo[1].shape)) __pyx_t_54 = 1;
11848  if (unlikely(__pyx_t_54 != -1)) {
11849  __Pyx_RaiseBufferIndexError(__pyx_t_54);
11850  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11851  }
11852  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.buf, __pyx_t_63, __pyx_pybuffernd_elementResidual.diminfo[0].strides, __pyx_t_64, __pyx_pybuffernd_elementResidual.diminfo[1].strides) += (((__pyx_v_weight * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf, __pyx_t_53, __pyx_pybuffernd_a_up.diminfo[0].strides))) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.buf, __pyx_t_56, __pyx_pybuffernd_q_grad_u.diminfo[0].strides, __pyx_t_57, __pyx_pybuffernd_q_grad_u.diminfo[1].strides, __pyx_t_58, __pyx_pybuffernd_q_grad_u.diminfo[2].strides))) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.buf, __pyx_t_59, __pyx_pybuffernd_q_grad_w.diminfo[0].strides, __pyx_t_60, __pyx_pybuffernd_q_grad_w.diminfo[1].strides, __pyx_t_61, __pyx_pybuffernd_q_grad_w.diminfo[2].strides, __pyx_t_62, __pyx_pybuffernd_q_grad_w.diminfo[3].strides)));
11853  }
11854  }
11855  }
11856  }
11857  }
11858 
11859  /* "subsurfaceTransportFunctions.pyx":486
11860  * #eN for upwind
11861  *
11862  * def RE_NCP1_getElementResidual(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
11863  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
11864  * numpy.ndarray[ITYPE_t,ndim=1] colind,
11865  */
11866 
11867  /* function exit code */
11868  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11869  goto __pyx_L0;
11870  __pyx_L1_error:;
11871  __Pyx_XDECREF(__pyx_t_1);
11872  __Pyx_XDECREF(__pyx_t_2);
11873  __Pyx_XDECREF(__pyx_t_4);
11874  __Pyx_XDECREF(__pyx_t_5);
11875  __Pyx_XDECREF(__pyx_t_9);
11876  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
11877  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
11878  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer);
11879  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
11880  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
11881  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
11882  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementResidual.rcbuffer->pybuffer);
11883  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer);
11884  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
11885  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
11886  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer);
11887  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
11888  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer);
11889  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer);
11890  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
11891  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
11892  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer);
11893  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer);
11894  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
11895  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
11896  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
11897  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
11898  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_getElementResidual", __pyx_clineno, __pyx_lineno, __pyx_filename);
11899  __pyx_r = NULL;
11900  goto __pyx_L2;
11901  __pyx_L0:;
11902  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer);
11903  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
11904  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
11905  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
11906  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementResidual.rcbuffer->pybuffer);
11907  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer);
11908  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
11909  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
11910  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer);
11911  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
11912  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer);
11913  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer);
11914  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
11915  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
11916  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer);
11917  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer);
11918  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
11919  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
11920  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
11921  __pyx_L2:;
11922  __Pyx_XDECREF(__pyx_v_q);
11923  __Pyx_XDECREF((PyObject *)__pyx_v_a_up);
11924  __Pyx_XDECREF((PyObject *)__pyx_v_f_up);
11925  __Pyx_XGIVEREF(__pyx_r);
11926  __Pyx_RefNannyFinishContext();
11927  return __pyx_r;
11928 }
11929 
11930 /* "subsurfaceTransportFunctions.pyx":574
11931  * #i
11932  * #eN
11933  * def RE_NCP1_getElementJacobian(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
11934  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
11935  * numpy.ndarray[ITYPE_t,ndim=1] colind,
11936  */
11937 
11938 /* Python wrapper */
11939 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
11940 static char __pyx_doc_28subsurfaceTransportFunctions_34RE_NCP1_getElementJacobian[] = "\n residual routine for NCP1 approximation for conservative head formulation of Richards equation \n\n Approximation:\n uses nodal quadrature where the nodes are face barycenters\n uses harmonic average for intrinsic permeability/ hydraulic conductivity\n upwinds relative permeability based on element averages\n applies dirichlet boundary conditions strongly but keeps dofs in system\n\n TODO:\n everything\n \n ";
11941 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian = {"RE_NCP1_getElementJacobian", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_34RE_NCP1_getElementJacobian};
11942 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
11943  CYTHON_UNUSED PyArrayObject *__pyx_v_gravity = 0;
11944  PyArrayObject *__pyx_v_rowptr = 0;
11945  PyArrayObject *__pyx_v_colind = 0;
11946  int __pyx_v_nSpace;
11947  int __pyx_v_nElements_global;
11948  int __pyx_v_nElementBoundaries_element;
11949  CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray = 0;
11950  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray = 0;
11951  int __pyx_v_nDOF_test_element;
11952  int __pyx_v_nDOF_trial_element;
11953  PyArrayObject *__pyx_v_q_u = 0;
11954  CYTHON_UNUSED PyArrayObject *__pyx_v_q_grad_u = 0;
11955  PyArrayObject *__pyx_v_q_grad_w = 0;
11956  PyArrayObject *__pyx_v_q_grad_v = 0;
11957  PyArrayObject *__pyx_v_q_detJ = 0;
11958  PyArrayObject *__pyx_v_q_m = 0;
11959  CYTHON_UNUSED PyArrayObject *__pyx_v_q_dm = 0;
11960  PyArrayObject *__pyx_v_q_mt = 0;
11961  PyArrayObject *__pyx_v_q_dmt = 0;
11962  PyArrayObject *__pyx_v_q_r = 0;
11963  PyArrayObject *__pyx_v_q_kr = 0;
11964  CYTHON_UNUSED PyArrayObject *__pyx_v_q_dkr = 0;
11965  PyArrayObject *__pyx_v_q_kr_up = 0;
11966  PyArrayObject *__pyx_v_q_flin = 0;
11967  PyArrayObject *__pyx_v_q_alin = 0;
11968  PyArrayObject *__pyx_v_elementJacobian = 0;
11969  int __pyx_lineno = 0;
11970  const char *__pyx_filename = NULL;
11971  int __pyx_clineno = 0;
11972  PyObject *__pyx_r = 0;
11973  __Pyx_RefNannyDeclarations
11974  __Pyx_RefNannySetupContext("RE_NCP1_getElementJacobian (wrapper)", 0);
11975  {
11976  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gravity,&__pyx_n_s_rowptr,&__pyx_n_s_colind,&__pyx_n_s_nSpace,&__pyx_n_s_nElements_global,&__pyx_n_s_nElementBoundaries_element,&__pyx_n_s_elementNeighborsArray,&__pyx_n_s_elementBarycentersArray,&__pyx_n_s_nDOF_test_element,&__pyx_n_s_nDOF_trial_element,&__pyx_n_s_q_u,&__pyx_n_s_q_grad_u,&__pyx_n_s_q_grad_w,&__pyx_n_s_q_grad_v,&__pyx_n_s_q_detJ,&__pyx_n_s_q_m,&__pyx_n_s_q_dm,&__pyx_n_s_q_mt,&__pyx_n_s_q_dmt,&__pyx_n_s_q_r,&__pyx_n_s_q_kr,&__pyx_n_s_q_dkr,&__pyx_n_s_q_kr_up,&__pyx_n_s_q_flin,&__pyx_n_s_q_alin,&__pyx_n_s_elementJacobian,0};
11977  PyObject* values[26] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
11978  if (unlikely(__pyx_kwds)) {
11979  Py_ssize_t kw_args;
11980  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
11981  switch (pos_args) {
11982  case 26: values[25] = PyTuple_GET_ITEM(__pyx_args, 25);
11983  case 25: values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
11984  case 24: values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
11985  case 23: values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
11986  case 22: values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
11987  case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
11988  case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
11989  case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
11990  case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
11991  case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
11992  case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
11993  case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
11994  case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
11995  case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
11996  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
11997  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
11998  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
11999  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
12000  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
12001  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
12002  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
12003  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
12004  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
12005  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
12006  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
12007  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
12008  case 0: break;
12009  default: goto __pyx_L5_argtuple_error;
12010  }
12011  kw_args = PyDict_Size(__pyx_kwds);
12012  switch (pos_args) {
12013  case 0:
12014  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_gravity)) != 0)) kw_args--;
12015  else goto __pyx_L5_argtuple_error;
12016  case 1:
12017  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rowptr)) != 0)) kw_args--;
12018  else {
12019  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12020  }
12021  case 2:
12022  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_colind)) != 0)) kw_args--;
12023  else {
12024  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12025  }
12026  case 3:
12027  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nSpace)) != 0)) kw_args--;
12028  else {
12029  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12030  }
12031  case 4:
12032  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nElements_global)) != 0)) kw_args--;
12033  else {
12034  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12035  }
12036  case 5:
12037  if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nElementBoundaries_element)) != 0)) kw_args--;
12038  else {
12039  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12040  }
12041  case 6:
12042  if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementNeighborsArray)) != 0)) kw_args--;
12043  else {
12044  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12045  }
12046  case 7:
12047  if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
12048  else {
12049  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12050  }
12051  case 8:
12052  if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nDOF_test_element)) != 0)) kw_args--;
12053  else {
12054  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12055  }
12056  case 9:
12057  if (likely((values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nDOF_trial_element)) != 0)) kw_args--;
12058  else {
12059  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12060  }
12061  case 10:
12062  if (likely((values[10] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_u)) != 0)) kw_args--;
12063  else {
12064  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 10); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12065  }
12066  case 11:
12067  if (likely((values[11] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_grad_u)) != 0)) kw_args--;
12068  else {
12069  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 11); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12070  }
12071  case 12:
12072  if (likely((values[12] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_grad_w)) != 0)) kw_args--;
12073  else {
12074  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 12); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12075  }
12076  case 13:
12077  if (likely((values[13] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_grad_v)) != 0)) kw_args--;
12078  else {
12079  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 13); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12080  }
12081  case 14:
12082  if (likely((values[14] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_detJ)) != 0)) kw_args--;
12083  else {
12084  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 14); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12085  }
12086  case 15:
12087  if (likely((values[15] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_m)) != 0)) kw_args--;
12088  else {
12089  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 15); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12090  }
12091  case 16:
12092  if (likely((values[16] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_dm)) != 0)) kw_args--;
12093  else {
12094  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 16); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12095  }
12096  case 17:
12097  if (likely((values[17] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_mt)) != 0)) kw_args--;
12098  else {
12099  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 17); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12100  }
12101  case 18:
12102  if (likely((values[18] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_dmt)) != 0)) kw_args--;
12103  else {
12104  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 18); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12105  }
12106  case 19:
12107  if (likely((values[19] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_r)) != 0)) kw_args--;
12108  else {
12109  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 19); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12110  }
12111  case 20:
12112  if (likely((values[20] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_kr)) != 0)) kw_args--;
12113  else {
12114  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 20); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12115  }
12116  case 21:
12117  if (likely((values[21] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_dkr)) != 0)) kw_args--;
12118  else {
12119  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 21); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12120  }
12121  case 22:
12122  if (likely((values[22] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_kr_up)) != 0)) kw_args--;
12123  else {
12124  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 22); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12125  }
12126  case 23:
12127  if (likely((values[23] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_flin)) != 0)) kw_args--;
12128  else {
12129  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 23); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12130  }
12131  case 24:
12132  if (likely((values[24] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_alin)) != 0)) kw_args--;
12133  else {
12134  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 24); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12135  }
12136  case 25:
12137  if (likely((values[25] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementJacobian)) != 0)) kw_args--;
12138  else {
12139  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 25); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12140  }
12141  }
12142  if (unlikely(kw_args > 0)) {
12143  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RE_NCP1_getElementJacobian") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12144  }
12145  } else if (PyTuple_GET_SIZE(__pyx_args) != 26) {
12146  goto __pyx_L5_argtuple_error;
12147  } else {
12148  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
12149  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
12150  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
12151  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
12152  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
12153  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
12154  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
12155  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
12156  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
12157  values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
12158  values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
12159  values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
12160  values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
12161  values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
12162  values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
12163  values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
12164  values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
12165  values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
12166  values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
12167  values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
12168  values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
12169  values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
12170  values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
12171  values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
12172  values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
12173  values[25] = PyTuple_GET_ITEM(__pyx_args, 25);
12174  }
12175  __pyx_v_gravity = ((PyArrayObject *)values[0]);
12176  __pyx_v_rowptr = ((PyArrayObject *)values[1]);
12177  __pyx_v_colind = ((PyArrayObject *)values[2]);
12178  __pyx_v_nSpace = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nSpace == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12179  __pyx_v_nElements_global = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_nElements_global == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12180  __pyx_v_nElementBoundaries_element = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nElementBoundaries_element == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12181  __pyx_v_elementNeighborsArray = ((PyArrayObject *)values[6]);
12182  __pyx_v_elementBarycentersArray = ((PyArrayObject *)values[7]);
12183  __pyx_v_nDOF_test_element = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_nDOF_test_element == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12184  __pyx_v_nDOF_trial_element = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_nDOF_trial_element == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12185  __pyx_v_q_u = ((PyArrayObject *)values[10]);
12186  __pyx_v_q_grad_u = ((PyArrayObject *)values[11]);
12187  __pyx_v_q_grad_w = ((PyArrayObject *)values[12]);
12188  __pyx_v_q_grad_v = ((PyArrayObject *)values[13]);
12189  __pyx_v_q_detJ = ((PyArrayObject *)values[14]);
12190  __pyx_v_q_m = ((PyArrayObject *)values[15]);
12191  __pyx_v_q_dm = ((PyArrayObject *)values[16]);
12192  __pyx_v_q_mt = ((PyArrayObject *)values[17]);
12193  __pyx_v_q_dmt = ((PyArrayObject *)values[18]);
12194  __pyx_v_q_r = ((PyArrayObject *)values[19]);
12195  __pyx_v_q_kr = ((PyArrayObject *)values[20]);
12196  __pyx_v_q_dkr = ((PyArrayObject *)values[21]);
12197  __pyx_v_q_kr_up = ((PyArrayObject *)values[22]);
12198  __pyx_v_q_flin = ((PyArrayObject *)values[23]);
12199  __pyx_v_q_alin = ((PyArrayObject *)values[24]);
12200  __pyx_v_elementJacobian = ((PyArrayObject *)values[25]);
12201  }
12202  goto __pyx_L4_argument_unpacking_done;
12203  __pyx_L5_argtuple_error:;
12204  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12205  __pyx_L3_error:;
12206  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_getElementJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
12207  __Pyx_RefNannyFinishContext();
12208  return NULL;
12209  __pyx_L4_argument_unpacking_done:;
12210  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gravity), __pyx_ptype_5numpy_ndarray, 1, "gravity", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12211  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rowptr), __pyx_ptype_5numpy_ndarray, 1, "rowptr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12212  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_colind), __pyx_ptype_5numpy_ndarray, 1, "colind", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12213  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementNeighborsArray), __pyx_ptype_5numpy_ndarray, 1, "elementNeighborsArray", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12214  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_ptype_5numpy_ndarray, 1, "elementBarycentersArray", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12215  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_u), __pyx_ptype_5numpy_ndarray, 1, "q_u", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12216  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_u), __pyx_ptype_5numpy_ndarray, 1, "q_grad_u", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12217  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_w), __pyx_ptype_5numpy_ndarray, 1, "q_grad_w", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12218  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_v), __pyx_ptype_5numpy_ndarray, 1, "q_grad_v", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12219  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_detJ), __pyx_ptype_5numpy_ndarray, 1, "q_detJ", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12220  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_m), __pyx_ptype_5numpy_ndarray, 1, "q_m", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12221  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dm), __pyx_ptype_5numpy_ndarray, 1, "q_dm", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12222  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_mt), __pyx_ptype_5numpy_ndarray, 1, "q_mt", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12223  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dmt), __pyx_ptype_5numpy_ndarray, 1, "q_dmt", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12224  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_r), __pyx_ptype_5numpy_ndarray, 1, "q_r", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12225  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr), __pyx_ptype_5numpy_ndarray, 1, "q_kr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12226  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dkr), __pyx_ptype_5numpy_ndarray, 1, "q_dkr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12227  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr_up), __pyx_ptype_5numpy_ndarray, 1, "q_kr_up", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12228  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_flin), __pyx_ptype_5numpy_ndarray, 1, "q_flin", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12229  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_alin), __pyx_ptype_5numpy_ndarray, 1, "q_alin", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12230  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementJacobian), __pyx_ptype_5numpy_ndarray, 1, "elementJacobian", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12231  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_34RE_NCP1_getElementJacobian(__pyx_self, __pyx_v_gravity, __pyx_v_rowptr, __pyx_v_colind, __pyx_v_nSpace, __pyx_v_nElements_global, __pyx_v_nElementBoundaries_element, __pyx_v_elementNeighborsArray, __pyx_v_elementBarycentersArray, __pyx_v_nDOF_test_element, __pyx_v_nDOF_trial_element, __pyx_v_q_u, __pyx_v_q_grad_u, __pyx_v_q_grad_w, __pyx_v_q_grad_v, __pyx_v_q_detJ, __pyx_v_q_m, __pyx_v_q_dm, __pyx_v_q_mt, __pyx_v_q_dmt, __pyx_v_q_r, __pyx_v_q_kr, __pyx_v_q_dkr, __pyx_v_q_kr_up, __pyx_v_q_flin, __pyx_v_q_alin, __pyx_v_elementJacobian);
12232 
12233  /* function exit code */
12234  goto __pyx_L0;
12235  __pyx_L1_error:;
12236  __pyx_r = NULL;
12237  __pyx_L0:;
12238  __Pyx_RefNannyFinishContext();
12239  return __pyx_r;
12240 }
12241 
12242 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_34RE_NCP1_getElementJacobian(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray, int __pyx_v_nDOF_test_element, int __pyx_v_nDOF_trial_element, PyArrayObject *__pyx_v_q_u, CYTHON_UNUSED PyArrayObject *__pyx_v_q_grad_u, PyArrayObject *__pyx_v_q_grad_w, PyArrayObject *__pyx_v_q_grad_v, PyArrayObject *__pyx_v_q_detJ, PyArrayObject *__pyx_v_q_m, CYTHON_UNUSED PyArrayObject *__pyx_v_q_dm, PyArrayObject *__pyx_v_q_mt, PyArrayObject *__pyx_v_q_dmt, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, CYTHON_UNUSED PyArrayObject *__pyx_v_q_dkr, PyArrayObject *__pyx_v_q_kr_up, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin, PyArrayObject *__pyx_v_elementJacobian) {
12243  CYTHON_UNUSED int __pyx_v_upwindFlag;
12244  CYTHON_UNUSED int __pyx_v_picard;
12245  PyObject *__pyx_v_q = NULL;
12246  int __pyx_v_nnz;
12247  int __pyx_v_eN;
12248  int __pyx_v_ii;
12249  int __pyx_v_I;
12250  PyArrayObject *__pyx_v_a_up = 0;
12251  PyArrayObject *__pyx_v_f_up = 0;
12252  double __pyx_v_nAvgWeight;
12253  double __pyx_v_weight;
12254  double __pyx_v_volFactor;
12255  CYTHON_UNUSED int __pyx_v_thisElementIsUpwind;
12256  double __pyx_v_volume;
12257  int __pyx_v_i;
12258  int __pyx_v_ebN;
12259  int __pyx_v_j;
12260  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_up;
12261  __Pyx_Buffer __pyx_pybuffer_a_up;
12262  __Pyx_LocalBuf_ND __pyx_pybuffernd_colind;
12263  __Pyx_Buffer __pyx_pybuffer_colind;
12264  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBarycentersArray;
12265  __Pyx_Buffer __pyx_pybuffer_elementBarycentersArray;
12266  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementJacobian;
12267  __Pyx_Buffer __pyx_pybuffer_elementJacobian;
12268  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementNeighborsArray;
12269  __Pyx_Buffer __pyx_pybuffer_elementNeighborsArray;
12270  __Pyx_LocalBuf_ND __pyx_pybuffernd_f_up;
12271  __Pyx_Buffer __pyx_pybuffer_f_up;
12272  __Pyx_LocalBuf_ND __pyx_pybuffernd_gravity;
12273  __Pyx_Buffer __pyx_pybuffer_gravity;
12274  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_alin;
12275  __Pyx_Buffer __pyx_pybuffer_q_alin;
12276  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_detJ;
12277  __Pyx_Buffer __pyx_pybuffer_q_detJ;
12278  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dkr;
12279  __Pyx_Buffer __pyx_pybuffer_q_dkr;
12280  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dm;
12281  __Pyx_Buffer __pyx_pybuffer_q_dm;
12282  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dmt;
12283  __Pyx_Buffer __pyx_pybuffer_q_dmt;
12284  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_flin;
12285  __Pyx_Buffer __pyx_pybuffer_q_flin;
12286  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_u;
12287  __Pyx_Buffer __pyx_pybuffer_q_grad_u;
12288  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_v;
12289  __Pyx_Buffer __pyx_pybuffer_q_grad_v;
12290  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_w;
12291  __Pyx_Buffer __pyx_pybuffer_q_grad_w;
12292  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr;
12293  __Pyx_Buffer __pyx_pybuffer_q_kr;
12294  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr_up;
12295  __Pyx_Buffer __pyx_pybuffer_q_kr_up;
12296  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_m;
12297  __Pyx_Buffer __pyx_pybuffer_q_m;
12298  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_mt;
12299  __Pyx_Buffer __pyx_pybuffer_q_mt;
12300  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_r;
12301  __Pyx_Buffer __pyx_pybuffer_q_r;
12302  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_u;
12303  __Pyx_Buffer __pyx_pybuffer_q_u;
12304  __Pyx_LocalBuf_ND __pyx_pybuffernd_rowptr;
12305  __Pyx_Buffer __pyx_pybuffer_rowptr;
12306  PyObject *__pyx_r = NULL;
12307  __Pyx_RefNannyDeclarations
12308  PyObject *__pyx_t_1 = NULL;
12309  PyObject *__pyx_t_2 = NULL;
12310  Py_ssize_t __pyx_t_3;
12311  PyObject *__pyx_t_4 = NULL;
12312  PyObject *__pyx_t_5 = NULL;
12313  int __pyx_t_6;
12314  Py_ssize_t __pyx_t_7;
12315  int __pyx_t_8;
12316  PyObject *__pyx_t_9 = NULL;
12317  PyArrayObject *__pyx_t_10 = NULL;
12318  PyArrayObject *__pyx_t_11 = NULL;
12319  double __pyx_t_12;
12320  int __pyx_t_13;
12321  Py_ssize_t __pyx_t_14;
12322  Py_ssize_t __pyx_t_15;
12323  int __pyx_t_16;
12324  int __pyx_t_17;
12325  Py_ssize_t __pyx_t_18;
12326  Py_ssize_t __pyx_t_19;
12327  int __pyx_t_20;
12328  Py_ssize_t __pyx_t_21;
12329  Py_ssize_t __pyx_t_22;
12330  Py_ssize_t __pyx_t_23;
12331  int __pyx_t_24;
12332  int __pyx_t_25;
12333  int __pyx_t_26;
12334  Py_ssize_t __pyx_t_27;
12335  Py_ssize_t __pyx_t_28;
12336  Py_ssize_t __pyx_t_29;
12337  int __pyx_t_30;
12338  Py_ssize_t __pyx_t_31;
12339  Py_ssize_t __pyx_t_32;
12340  Py_ssize_t __pyx_t_33;
12341  Py_ssize_t __pyx_t_34;
12342  Py_ssize_t __pyx_t_35;
12343  Py_ssize_t __pyx_t_36;
12344  Py_ssize_t __pyx_t_37;
12345  Py_ssize_t __pyx_t_38;
12346  Py_ssize_t __pyx_t_39;
12347  int __pyx_t_40;
12348  Py_ssize_t __pyx_t_41;
12349  int __pyx_t_42;
12350  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_43;
12351  Py_ssize_t __pyx_t_44;
12352  Py_ssize_t __pyx_t_45;
12353  int __pyx_t_46;
12354  Py_ssize_t __pyx_t_47;
12355  Py_ssize_t __pyx_t_48;
12356  Py_ssize_t __pyx_t_49;
12357  Py_ssize_t __pyx_t_50;
12358  Py_ssize_t __pyx_t_51;
12359  Py_ssize_t __pyx_t_52;
12360  Py_ssize_t __pyx_t_53;
12361  Py_ssize_t __pyx_t_54;
12362  Py_ssize_t __pyx_t_55;
12363  Py_ssize_t __pyx_t_56;
12364  Py_ssize_t __pyx_t_57;
12365  Py_ssize_t __pyx_t_58;
12366  int __pyx_lineno = 0;
12367  const char *__pyx_filename = NULL;
12368  int __pyx_clineno = 0;
12369  __Pyx_RefNannySetupContext("RE_NCP1_getElementJacobian", 0);
12370  __pyx_pybuffer_a_up.pybuffer.buf = NULL;
12371  __pyx_pybuffer_a_up.refcount = 0;
12372  __pyx_pybuffernd_a_up.data = NULL;
12373  __pyx_pybuffernd_a_up.rcbuffer = &__pyx_pybuffer_a_up;
12374  __pyx_pybuffer_f_up.pybuffer.buf = NULL;
12375  __pyx_pybuffer_f_up.refcount = 0;
12376  __pyx_pybuffernd_f_up.data = NULL;
12377  __pyx_pybuffernd_f_up.rcbuffer = &__pyx_pybuffer_f_up;
12378  __pyx_pybuffer_gravity.pybuffer.buf = NULL;
12379  __pyx_pybuffer_gravity.refcount = 0;
12380  __pyx_pybuffernd_gravity.data = NULL;
12381  __pyx_pybuffernd_gravity.rcbuffer = &__pyx_pybuffer_gravity;
12382  __pyx_pybuffer_rowptr.pybuffer.buf = NULL;
12383  __pyx_pybuffer_rowptr.refcount = 0;
12384  __pyx_pybuffernd_rowptr.data = NULL;
12385  __pyx_pybuffernd_rowptr.rcbuffer = &__pyx_pybuffer_rowptr;
12386  __pyx_pybuffer_colind.pybuffer.buf = NULL;
12387  __pyx_pybuffer_colind.refcount = 0;
12388  __pyx_pybuffernd_colind.data = NULL;
12389  __pyx_pybuffernd_colind.rcbuffer = &__pyx_pybuffer_colind;
12390  __pyx_pybuffer_elementNeighborsArray.pybuffer.buf = NULL;
12391  __pyx_pybuffer_elementNeighborsArray.refcount = 0;
12392  __pyx_pybuffernd_elementNeighborsArray.data = NULL;
12393  __pyx_pybuffernd_elementNeighborsArray.rcbuffer = &__pyx_pybuffer_elementNeighborsArray;
12394  __pyx_pybuffer_elementBarycentersArray.pybuffer.buf = NULL;
12395  __pyx_pybuffer_elementBarycentersArray.refcount = 0;
12396  __pyx_pybuffernd_elementBarycentersArray.data = NULL;
12397  __pyx_pybuffernd_elementBarycentersArray.rcbuffer = &__pyx_pybuffer_elementBarycentersArray;
12398  __pyx_pybuffer_q_u.pybuffer.buf = NULL;
12399  __pyx_pybuffer_q_u.refcount = 0;
12400  __pyx_pybuffernd_q_u.data = NULL;
12401  __pyx_pybuffernd_q_u.rcbuffer = &__pyx_pybuffer_q_u;
12402  __pyx_pybuffer_q_grad_u.pybuffer.buf = NULL;
12403  __pyx_pybuffer_q_grad_u.refcount = 0;
12404  __pyx_pybuffernd_q_grad_u.data = NULL;
12405  __pyx_pybuffernd_q_grad_u.rcbuffer = &__pyx_pybuffer_q_grad_u;
12406  __pyx_pybuffer_q_grad_w.pybuffer.buf = NULL;
12407  __pyx_pybuffer_q_grad_w.refcount = 0;
12408  __pyx_pybuffernd_q_grad_w.data = NULL;
12409  __pyx_pybuffernd_q_grad_w.rcbuffer = &__pyx_pybuffer_q_grad_w;
12410  __pyx_pybuffer_q_grad_v.pybuffer.buf = NULL;
12411  __pyx_pybuffer_q_grad_v.refcount = 0;
12412  __pyx_pybuffernd_q_grad_v.data = NULL;
12413  __pyx_pybuffernd_q_grad_v.rcbuffer = &__pyx_pybuffer_q_grad_v;
12414  __pyx_pybuffer_q_detJ.pybuffer.buf = NULL;
12415  __pyx_pybuffer_q_detJ.refcount = 0;
12416  __pyx_pybuffernd_q_detJ.data = NULL;
12417  __pyx_pybuffernd_q_detJ.rcbuffer = &__pyx_pybuffer_q_detJ;
12418  __pyx_pybuffer_q_m.pybuffer.buf = NULL;
12419  __pyx_pybuffer_q_m.refcount = 0;
12420  __pyx_pybuffernd_q_m.data = NULL;
12421  __pyx_pybuffernd_q_m.rcbuffer = &__pyx_pybuffer_q_m;
12422  __pyx_pybuffer_q_dm.pybuffer.buf = NULL;
12423  __pyx_pybuffer_q_dm.refcount = 0;
12424  __pyx_pybuffernd_q_dm.data = NULL;
12425  __pyx_pybuffernd_q_dm.rcbuffer = &__pyx_pybuffer_q_dm;
12426  __pyx_pybuffer_q_mt.pybuffer.buf = NULL;
12427  __pyx_pybuffer_q_mt.refcount = 0;
12428  __pyx_pybuffernd_q_mt.data = NULL;
12429  __pyx_pybuffernd_q_mt.rcbuffer = &__pyx_pybuffer_q_mt;
12430  __pyx_pybuffer_q_dmt.pybuffer.buf = NULL;
12431  __pyx_pybuffer_q_dmt.refcount = 0;
12432  __pyx_pybuffernd_q_dmt.data = NULL;
12433  __pyx_pybuffernd_q_dmt.rcbuffer = &__pyx_pybuffer_q_dmt;
12434  __pyx_pybuffer_q_r.pybuffer.buf = NULL;
12435  __pyx_pybuffer_q_r.refcount = 0;
12436  __pyx_pybuffernd_q_r.data = NULL;
12437  __pyx_pybuffernd_q_r.rcbuffer = &__pyx_pybuffer_q_r;
12438  __pyx_pybuffer_q_kr.pybuffer.buf = NULL;
12439  __pyx_pybuffer_q_kr.refcount = 0;
12440  __pyx_pybuffernd_q_kr.data = NULL;
12441  __pyx_pybuffernd_q_kr.rcbuffer = &__pyx_pybuffer_q_kr;
12442  __pyx_pybuffer_q_dkr.pybuffer.buf = NULL;
12443  __pyx_pybuffer_q_dkr.refcount = 0;
12444  __pyx_pybuffernd_q_dkr.data = NULL;
12445  __pyx_pybuffernd_q_dkr.rcbuffer = &__pyx_pybuffer_q_dkr;
12446  __pyx_pybuffer_q_kr_up.pybuffer.buf = NULL;
12447  __pyx_pybuffer_q_kr_up.refcount = 0;
12448  __pyx_pybuffernd_q_kr_up.data = NULL;
12449  __pyx_pybuffernd_q_kr_up.rcbuffer = &__pyx_pybuffer_q_kr_up;
12450  __pyx_pybuffer_q_flin.pybuffer.buf = NULL;
12451  __pyx_pybuffer_q_flin.refcount = 0;
12452  __pyx_pybuffernd_q_flin.data = NULL;
12453  __pyx_pybuffernd_q_flin.rcbuffer = &__pyx_pybuffer_q_flin;
12454  __pyx_pybuffer_q_alin.pybuffer.buf = NULL;
12455  __pyx_pybuffer_q_alin.refcount = 0;
12456  __pyx_pybuffernd_q_alin.data = NULL;
12457  __pyx_pybuffernd_q_alin.rcbuffer = &__pyx_pybuffer_q_alin;
12458  __pyx_pybuffer_elementJacobian.pybuffer.buf = NULL;
12459  __pyx_pybuffer_elementJacobian.refcount = 0;
12460  __pyx_pybuffernd_elementJacobian.data = NULL;
12461  __pyx_pybuffernd_elementJacobian.rcbuffer = &__pyx_pybuffer_elementJacobian;
12462  {
12463  __Pyx_BufFmt_StackElem __pyx_stack[1];
12464  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer, (PyObject*)__pyx_v_gravity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12465  }
12466  __pyx_pybuffernd_gravity.diminfo[0].strides = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_gravity.diminfo[0].shape = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.shape[0];
12467  {
12468  __Pyx_BufFmt_StackElem __pyx_stack[1];
12469  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_rowptr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12470  }
12471  __pyx_pybuffernd_rowptr.diminfo[0].strides = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rowptr.diminfo[0].shape = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.shape[0];
12472  {
12473  __Pyx_BufFmt_StackElem __pyx_stack[1];
12474  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_colind.rcbuffer->pybuffer, (PyObject*)__pyx_v_colind, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12475  }
12476  __pyx_pybuffernd_colind.diminfo[0].strides = __pyx_pybuffernd_colind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_colind.diminfo[0].shape = __pyx_pybuffernd_colind.rcbuffer->pybuffer.shape[0];
12477  {
12478  __Pyx_BufFmt_StackElem __pyx_stack[1];
12479  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementNeighborsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12480  }
12481  __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[1];
12482  {
12483  __Pyx_BufFmt_StackElem __pyx_stack[1];
12484  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBarycentersArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12485  }
12486  __pyx_pybuffernd_elementBarycentersArray.diminfo[0].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[0].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[1];
12487  {
12488  __Pyx_BufFmt_StackElem __pyx_stack[1];
12489  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12490  }
12491  __pyx_pybuffernd_q_u.diminfo[0].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_u.diminfo[0].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_u.diminfo[1].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_u.diminfo[1].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[1];
12492  {
12493  __Pyx_BufFmt_StackElem __pyx_stack[1];
12494  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12495  }
12496  __pyx_pybuffernd_q_grad_u.diminfo[0].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_u.diminfo[0].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_u.diminfo[1].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_u.diminfo[1].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_u.diminfo[2].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_u.diminfo[2].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[2];
12497  {
12498  __Pyx_BufFmt_StackElem __pyx_stack[1];
12499  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_w, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12500  }
12501  __pyx_pybuffernd_q_grad_w.diminfo[0].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_w.diminfo[0].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_w.diminfo[1].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_w.diminfo[1].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_w.diminfo[2].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_w.diminfo[2].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_q_grad_w.diminfo[3].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_q_grad_w.diminfo[3].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[3];
12502  {
12503  __Pyx_BufFmt_StackElem __pyx_stack[1];
12504  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12505  }
12506  __pyx_pybuffernd_q_grad_v.diminfo[0].strides = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_v.diminfo[0].shape = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_v.diminfo[1].strides = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_v.diminfo[1].shape = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_v.diminfo[2].strides = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_v.diminfo[2].shape = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_q_grad_v.diminfo[3].strides = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_q_grad_v.diminfo[3].shape = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.shape[3];
12507  {
12508  __Pyx_BufFmt_StackElem __pyx_stack[1];
12509  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_detJ, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12510  }
12511  __pyx_pybuffernd_q_detJ.diminfo[0].strides = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_detJ.diminfo[0].shape = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_detJ.diminfo[1].strides = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_detJ.diminfo[1].shape = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.shape[1];
12512  {
12513  __Pyx_BufFmt_StackElem __pyx_stack[1];
12514  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_m, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12515  }
12516  __pyx_pybuffernd_q_m.diminfo[0].strides = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_m.diminfo[0].shape = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_m.diminfo[1].strides = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_m.diminfo[1].shape = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.shape[1];
12517  {
12518  __Pyx_BufFmt_StackElem __pyx_stack[1];
12519  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dm.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dm, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12520  }
12521  __pyx_pybuffernd_q_dm.diminfo[0].strides = __pyx_pybuffernd_q_dm.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dm.diminfo[0].shape = __pyx_pybuffernd_q_dm.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dm.diminfo[1].strides = __pyx_pybuffernd_q_dm.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dm.diminfo[1].shape = __pyx_pybuffernd_q_dm.rcbuffer->pybuffer.shape[1];
12522  {
12523  __Pyx_BufFmt_StackElem __pyx_stack[1];
12524  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_mt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12525  }
12526  __pyx_pybuffernd_q_mt.diminfo[0].strides = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_mt.diminfo[0].shape = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_mt.diminfo[1].strides = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_mt.diminfo[1].shape = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.shape[1];
12527  {
12528  __Pyx_BufFmt_StackElem __pyx_stack[1];
12529  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dmt.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dmt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12530  }
12531  __pyx_pybuffernd_q_dmt.diminfo[0].strides = __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dmt.diminfo[0].shape = __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dmt.diminfo[1].strides = __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dmt.diminfo[1].shape = __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.shape[1];
12532  {
12533  __Pyx_BufFmt_StackElem __pyx_stack[1];
12534  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_r, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12535  }
12536  __pyx_pybuffernd_q_r.diminfo[0].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_r.diminfo[0].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_r.diminfo[1].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_r.diminfo[1].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[1];
12537  {
12538  __Pyx_BufFmt_StackElem __pyx_stack[1];
12539  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12540  }
12541  __pyx_pybuffernd_q_kr.diminfo[0].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr.diminfo[0].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr.diminfo[1].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr.diminfo[1].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[1];
12542  {
12543  __Pyx_BufFmt_StackElem __pyx_stack[1];
12544  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dkr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12545  }
12546  __pyx_pybuffernd_q_dkr.diminfo[0].strides = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dkr.diminfo[0].shape = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dkr.diminfo[1].strides = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dkr.diminfo[1].shape = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.shape[1];
12547  {
12548  __Pyx_BufFmt_StackElem __pyx_stack[1];
12549  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr_up, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12550  }
12551  __pyx_pybuffernd_q_kr_up.diminfo[0].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr_up.diminfo[0].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr_up.diminfo[1].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr_up.diminfo[1].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[1];
12552  {
12553  __Pyx_BufFmt_StackElem __pyx_stack[1];
12554  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_flin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12555  }
12556  __pyx_pybuffernd_q_flin.diminfo[0].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_flin.diminfo[0].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_flin.diminfo[1].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_flin.diminfo[1].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_flin.diminfo[2].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_flin.diminfo[2].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[2];
12557  {
12558  __Pyx_BufFmt_StackElem __pyx_stack[1];
12559  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_alin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12560  }
12561  __pyx_pybuffernd_q_alin.diminfo[0].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_alin.diminfo[0].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_alin.diminfo[1].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_alin.diminfo[1].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_alin.diminfo[2].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_alin.diminfo[2].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[2];
12562  {
12563  __Pyx_BufFmt_StackElem __pyx_stack[1];
12564  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementJacobian, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12565  }
12566  __pyx_pybuffernd_elementJacobian.diminfo[0].strides = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementJacobian.diminfo[0].shape = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementJacobian.diminfo[1].strides = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementJacobian.diminfo[1].shape = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_elementJacobian.diminfo[2].strides = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_elementJacobian.diminfo[2].shape = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.shape[2];
12567 
12568  /* "subsurfaceTransportFunctions.pyx":620
12569  *
12570  * """
12571  * cdef int upwindFlag = 1 # <<<<<<<<<<<<<<
12572  * cdef int picard = 1
12573  * #check some sizes
12574  */
12575  __pyx_v_upwindFlag = 1;
12576 
12577  /* "subsurfaceTransportFunctions.pyx":621
12578  * """
12579  * cdef int upwindFlag = 1
12580  * cdef int picard = 1 # <<<<<<<<<<<<<<
12581  * #check some sizes
12582  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
12583  */
12584  __pyx_v_picard = 1;
12585 
12586  /* "subsurfaceTransportFunctions.pyx":623
12587  * cdef int picard = 1
12588  * #check some sizes
12589  * for q in [q_u,q_m,q_mt,q_r,q_kr]: # <<<<<<<<<<<<<<
12590  * assert q.shape[1] == nSpace+1
12591  * assert nDOF_test_element == nSpace+1
12592  */
12593  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12594  __Pyx_GOTREF(__pyx_t_1);
12595  __Pyx_INCREF(((PyObject *)__pyx_v_q_u));
12596  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_u));
12597  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_q_u));
12598  __Pyx_INCREF(((PyObject *)__pyx_v_q_m));
12599  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_m));
12600  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_q_m));
12601  __Pyx_INCREF(((PyObject *)__pyx_v_q_mt));
12602  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_mt));
12603  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_q_mt));
12604  __Pyx_INCREF(((PyObject *)__pyx_v_q_r));
12605  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_r));
12606  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_q_r));
12607  __Pyx_INCREF(((PyObject *)__pyx_v_q_kr));
12608  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_kr));
12609  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_q_kr));
12610  __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
12611  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12612  for (;;) {
12613  if (__pyx_t_3 >= 5) break;
12614  #if CYTHON_COMPILING_IN_CPYTHON
12615  __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12616  #else
12617  __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12618  __Pyx_GOTREF(__pyx_t_1);
12619  #endif
12620  __Pyx_XDECREF_SET(__pyx_v_q, __pyx_t_1);
12621  __pyx_t_1 = 0;
12622 
12623  /* "subsurfaceTransportFunctions.pyx":624
12624  * #check some sizes
12625  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
12626  * assert q.shape[1] == nSpace+1 # <<<<<<<<<<<<<<
12627  * assert nDOF_test_element == nSpace+1
12628  * cdef int nnz = rowptr[nSpace]
12629  */
12630  #ifndef CYTHON_WITHOUT_ASSERTIONS
12631  if (unlikely(!Py_OptimizeFlag)) {
12632  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_q, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12633  __Pyx_GOTREF(__pyx_t_1);
12634  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
12635  __Pyx_GOTREF(__pyx_t_4);
12636  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12637  __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_nSpace + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12638  __Pyx_GOTREF(__pyx_t_1);
12639  __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12640  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12641  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12642  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12643  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12644  if (unlikely(!__pyx_t_6)) {
12645  PyErr_SetNone(PyExc_AssertionError);
12646  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12647  }
12648  }
12649  #endif
12650 
12651  /* "subsurfaceTransportFunctions.pyx":623
12652  * cdef int picard = 1
12653  * #check some sizes
12654  * for q in [q_u,q_m,q_mt,q_r,q_kr]: # <<<<<<<<<<<<<<
12655  * assert q.shape[1] == nSpace+1
12656  * assert nDOF_test_element == nSpace+1
12657  */
12658  }
12659  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12660 
12661  /* "subsurfaceTransportFunctions.pyx":625
12662  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
12663  * assert q.shape[1] == nSpace+1
12664  * assert nDOF_test_element == nSpace+1 # <<<<<<<<<<<<<<
12665  * cdef int nnz = rowptr[nSpace]
12666  * #temporaries
12667  */
12668  #ifndef CYTHON_WITHOUT_ASSERTIONS
12669  if (unlikely(!Py_OptimizeFlag)) {
12670  if (unlikely(!((__pyx_v_nDOF_test_element == (__pyx_v_nSpace + 1)) != 0))) {
12671  PyErr_SetNone(PyExc_AssertionError);
12672  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12673  }
12674  }
12675  #endif
12676 
12677  /* "subsurfaceTransportFunctions.pyx":626
12678  * assert q.shape[1] == nSpace+1
12679  * assert nDOF_test_element == nSpace+1
12680  * cdef int nnz = rowptr[nSpace] # <<<<<<<<<<<<<<
12681  * #temporaries
12682  * cdef double u_eN,kr_eN,phi_eN,u_neig,kr_neig,phi_neig,dkr_up
12683  */
12684  __pyx_t_7 = __pyx_v_nSpace;
12685  __pyx_t_8 = -1;
12686  if (__pyx_t_7 < 0) {
12687  __pyx_t_7 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
12688  if (unlikely(__pyx_t_7 < 0)) __pyx_t_8 = 0;
12689  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_8 = 0;
12690  if (unlikely(__pyx_t_8 != -1)) {
12691  __Pyx_RaiseBufferIndexError(__pyx_t_8);
12692  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12693  }
12694  __pyx_v_nnz = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_rowptr.diminfo[0].strides));
12695 
12696  /* "subsurfaceTransportFunctions.pyx":630
12697  * cdef double u_eN,kr_eN,phi_eN,u_neig,kr_neig,phi_neig,dkr_up
12698  * cdef int eN,eN_neighbor,ii,I
12699  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_up= numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
12700  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d')
12701  * #for averaging/integration weights
12702  */
12703  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12704  __Pyx_GOTREF(__pyx_t_5);
12705  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12706  __Pyx_GOTREF(__pyx_t_1);
12707  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12708  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12709  __Pyx_GOTREF(__pyx_t_5);
12710  __pyx_t_4 = NULL;
12711  __pyx_t_3 = 0;
12712  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
12713  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
12714  if (likely(__pyx_t_4)) {
12715  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
12716  __Pyx_INCREF(__pyx_t_4);
12717  __Pyx_INCREF(function);
12718  __Pyx_DECREF_SET(__pyx_t_1, function);
12719  __pyx_t_3 = 1;
12720  }
12721  }
12722  __pyx_t_9 = PyTuple_New(2+__pyx_t_3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12723  __Pyx_GOTREF(__pyx_t_9);
12724  if (__pyx_t_4) {
12725  __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __pyx_t_4 = NULL;
12726  }
12727  __Pyx_GIVEREF(__pyx_t_5);
12728  PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_3, __pyx_t_5);
12729  __Pyx_INCREF(__pyx_n_s_d);
12730  __Pyx_GIVEREF(__pyx_n_s_d);
12731  PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_3, __pyx_n_s_d);
12732  __pyx_t_5 = 0;
12733  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12734  __Pyx_GOTREF(__pyx_t_2);
12735  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12736  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12737  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12738  __pyx_t_10 = ((PyArrayObject *)__pyx_t_2);
12739  {
12740  __Pyx_BufFmt_StackElem __pyx_stack[1];
12741  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
12742  __pyx_v_a_up = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf = NULL;
12743  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12744  } else {__pyx_pybuffernd_a_up.diminfo[0].strides = __pyx_pybuffernd_a_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_up.diminfo[0].shape = __pyx_pybuffernd_a_up.rcbuffer->pybuffer.shape[0];
12745  }
12746  }
12747  __pyx_t_10 = 0;
12748  __pyx_v_a_up = ((PyArrayObject *)__pyx_t_2);
12749  __pyx_t_2 = 0;
12750 
12751  /* "subsurfaceTransportFunctions.pyx":631
12752  * cdef int eN,eN_neighbor,ii,I
12753  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_up= numpy.zeros(nnz,'d')
12754  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d') # <<<<<<<<<<<<<<
12755  * #for averaging/integration weights
12756  * cdef double nAvgWeight = 1.0/(nSpace+1.)
12757  */
12758  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12759  __Pyx_GOTREF(__pyx_t_1);
12760  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12761  __Pyx_GOTREF(__pyx_t_9);
12762  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12763  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_nSpace); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12764  __Pyx_GOTREF(__pyx_t_1);
12765  __pyx_t_5 = NULL;
12766  __pyx_t_3 = 0;
12767  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_9))) {
12768  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9);
12769  if (likely(__pyx_t_5)) {
12770  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
12771  __Pyx_INCREF(__pyx_t_5);
12772  __Pyx_INCREF(function);
12773  __Pyx_DECREF_SET(__pyx_t_9, function);
12774  __pyx_t_3 = 1;
12775  }
12776  }
12777  __pyx_t_4 = PyTuple_New(2+__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12778  __Pyx_GOTREF(__pyx_t_4);
12779  if (__pyx_t_5) {
12780  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
12781  }
12782  __Pyx_GIVEREF(__pyx_t_1);
12783  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_3, __pyx_t_1);
12784  __Pyx_INCREF(__pyx_n_s_d);
12785  __Pyx_GIVEREF(__pyx_n_s_d);
12786  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_3, __pyx_n_s_d);
12787  __pyx_t_1 = 0;
12788  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12789  __Pyx_GOTREF(__pyx_t_2);
12790  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12791  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12792  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12793  __pyx_t_11 = ((PyArrayObject *)__pyx_t_2);
12794  {
12795  __Pyx_BufFmt_StackElem __pyx_stack[1];
12796  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
12797  __pyx_v_f_up = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf = NULL;
12798  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12799  } else {__pyx_pybuffernd_f_up.diminfo[0].strides = __pyx_pybuffernd_f_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_f_up.diminfo[0].shape = __pyx_pybuffernd_f_up.rcbuffer->pybuffer.shape[0];
12800  }
12801  }
12802  __pyx_t_11 = 0;
12803  __pyx_v_f_up = ((PyArrayObject *)__pyx_t_2);
12804  __pyx_t_2 = 0;
12805 
12806  /* "subsurfaceTransportFunctions.pyx":633
12807  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d')
12808  * #for averaging/integration weights
12809  * cdef double nAvgWeight = 1.0/(nSpace+1.) # <<<<<<<<<<<<<<
12810  * cdef double weight=1.0,volFactor = 1.0
12811  * cdef int thisElementIsUpwind = 1
12812  */
12813  __pyx_t_12 = (__pyx_v_nSpace + 1.);
12814  if (unlikely(__pyx_t_12 == 0)) {
12815  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
12816  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12817  }
12818  __pyx_v_nAvgWeight = (1.0 / __pyx_t_12);
12819 
12820  /* "subsurfaceTransportFunctions.pyx":634
12821  * #for averaging/integration weights
12822  * cdef double nAvgWeight = 1.0/(nSpace+1.)
12823  * cdef double weight=1.0,volFactor = 1.0 # <<<<<<<<<<<<<<
12824  * cdef int thisElementIsUpwind = 1
12825  * if nSpace == 2:
12826  */
12827  __pyx_v_weight = 1.0;
12828  __pyx_v_volFactor = 1.0;
12829 
12830  /* "subsurfaceTransportFunctions.pyx":635
12831  * cdef double nAvgWeight = 1.0/(nSpace+1.)
12832  * cdef double weight=1.0,volFactor = 1.0
12833  * cdef int thisElementIsUpwind = 1 # <<<<<<<<<<<<<<
12834  * if nSpace == 2:
12835  * volFactor = 0.5
12836  */
12837  __pyx_v_thisElementIsUpwind = 1;
12838 
12839  /* "subsurfaceTransportFunctions.pyx":636
12840  * cdef double weight=1.0,volFactor = 1.0
12841  * cdef int thisElementIsUpwind = 1
12842  * if nSpace == 2: # <<<<<<<<<<<<<<
12843  * volFactor = 0.5
12844  * if nSpace == 3:
12845  */
12846  __pyx_t_6 = ((__pyx_v_nSpace == 2) != 0);
12847  if (__pyx_t_6) {
12848 
12849  /* "subsurfaceTransportFunctions.pyx":637
12850  * cdef int thisElementIsUpwind = 1
12851  * if nSpace == 2:
12852  * volFactor = 0.5 # <<<<<<<<<<<<<<
12853  * if nSpace == 3:
12854  * volFactor = 1.0/6.0
12855  */
12856  __pyx_v_volFactor = 0.5;
12857 
12858  /* "subsurfaceTransportFunctions.pyx":636
12859  * cdef double weight=1.0,volFactor = 1.0
12860  * cdef int thisElementIsUpwind = 1
12861  * if nSpace == 2: # <<<<<<<<<<<<<<
12862  * volFactor = 0.5
12863  * if nSpace == 3:
12864  */
12865  }
12866 
12867  /* "subsurfaceTransportFunctions.pyx":638
12868  * if nSpace == 2:
12869  * volFactor = 0.5
12870  * if nSpace == 3: # <<<<<<<<<<<<<<
12871  * volFactor = 1.0/6.0
12872  * #
12873  */
12874  __pyx_t_6 = ((__pyx_v_nSpace == 3) != 0);
12875  if (__pyx_t_6) {
12876 
12877  /* "subsurfaceTransportFunctions.pyx":639
12878  * volFactor = 0.5
12879  * if nSpace == 3:
12880  * volFactor = 1.0/6.0 # <<<<<<<<<<<<<<
12881  * #
12882  * for eN in range(nElements_global):
12883  */
12884  __pyx_v_volFactor = (1.0 / 6.0);
12885 
12886  /* "subsurfaceTransportFunctions.pyx":638
12887  * if nSpace == 2:
12888  * volFactor = 0.5
12889  * if nSpace == 3: # <<<<<<<<<<<<<<
12890  * volFactor = 1.0/6.0
12891  * #
12892  */
12893  }
12894 
12895  /* "subsurfaceTransportFunctions.pyx":641
12896  * volFactor = 1.0/6.0
12897  * #
12898  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
12899  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation
12900  * weight = nAvgWeight*volume
12901  */
12902  __pyx_t_8 = __pyx_v_nElements_global;
12903  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_8; __pyx_t_13+=1) {
12904  __pyx_v_eN = __pyx_t_13;
12905 
12906  /* "subsurfaceTransportFunctions.pyx":642
12907  * #
12908  * for eN in range(nElements_global):
12909  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation # <<<<<<<<<<<<<<
12910  * weight = nAvgWeight*volume
12911  *
12912  */
12913  __pyx_t_14 = __pyx_v_eN;
12914  __pyx_t_15 = 0;
12915  __pyx_t_16 = -1;
12916  if (__pyx_t_14 < 0) {
12917  __pyx_t_14 += __pyx_pybuffernd_q_detJ.diminfo[0].shape;
12918  if (unlikely(__pyx_t_14 < 0)) __pyx_t_16 = 0;
12919  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_q_detJ.diminfo[0].shape)) __pyx_t_16 = 0;
12920  if (__pyx_t_15 < 0) {
12921  __pyx_t_15 += __pyx_pybuffernd_q_detJ.diminfo[1].shape;
12922  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 1;
12923  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_detJ.diminfo[1].shape)) __pyx_t_16 = 1;
12924  if (unlikely(__pyx_t_16 != -1)) {
12925  __Pyx_RaiseBufferIndexError(__pyx_t_16);
12926  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12927  }
12928  __pyx_v_volume = (__pyx_v_volFactor * fabs((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_q_detJ.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_detJ.diminfo[1].strides))));
12929 
12930  /* "subsurfaceTransportFunctions.pyx":643
12931  * for eN in range(nElements_global):
12932  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation
12933  * weight = nAvgWeight*volume # <<<<<<<<<<<<<<
12934  *
12935  *
12936  */
12937  __pyx_v_weight = (__pyx_v_nAvgWeight * __pyx_v_volume);
12938 
12939  /* "subsurfaceTransportFunctions.pyx":646
12940  *
12941  *
12942  * for i in range(nDOF_test_element): # <<<<<<<<<<<<<<
12943  * #nodal quadrature so diagonal
12944  * ##mass
12945  */
12946  __pyx_t_16 = __pyx_v_nDOF_test_element;
12947  for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
12948  __pyx_v_i = __pyx_t_17;
12949 
12950  /* "subsurfaceTransportFunctions.pyx":650
12951  * ##mass
12952  * #elementResidual[eN,i] += weight*q_m[eN,i]
12953  * elementJacobian[eN,i,i] += weight*q_dmt[eN,i] # <<<<<<<<<<<<<<
12954  *
12955  * #have to actually compute loop over other nodes for stiffness terms
12956  */
12957  __pyx_t_18 = __pyx_v_eN;
12958  __pyx_t_19 = __pyx_v_i;
12959  __pyx_t_20 = -1;
12960  if (__pyx_t_18 < 0) {
12961  __pyx_t_18 += __pyx_pybuffernd_q_dmt.diminfo[0].shape;
12962  if (unlikely(__pyx_t_18 < 0)) __pyx_t_20 = 0;
12963  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_q_dmt.diminfo[0].shape)) __pyx_t_20 = 0;
12964  if (__pyx_t_19 < 0) {
12965  __pyx_t_19 += __pyx_pybuffernd_q_dmt.diminfo[1].shape;
12966  if (unlikely(__pyx_t_19 < 0)) __pyx_t_20 = 1;
12967  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_q_dmt.diminfo[1].shape)) __pyx_t_20 = 1;
12968  if (unlikely(__pyx_t_20 != -1)) {
12969  __Pyx_RaiseBufferIndexError(__pyx_t_20);
12970  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12971  }
12972  __pyx_t_21 = __pyx_v_eN;
12973  __pyx_t_22 = __pyx_v_i;
12974  __pyx_t_23 = __pyx_v_i;
12975  __pyx_t_20 = -1;
12976  if (__pyx_t_21 < 0) {
12977  __pyx_t_21 += __pyx_pybuffernd_elementJacobian.diminfo[0].shape;
12978  if (unlikely(__pyx_t_21 < 0)) __pyx_t_20 = 0;
12979  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_elementJacobian.diminfo[0].shape)) __pyx_t_20 = 0;
12980  if (__pyx_t_22 < 0) {
12981  __pyx_t_22 += __pyx_pybuffernd_elementJacobian.diminfo[1].shape;
12982  if (unlikely(__pyx_t_22 < 0)) __pyx_t_20 = 1;
12983  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_elementJacobian.diminfo[1].shape)) __pyx_t_20 = 1;
12984  if (__pyx_t_23 < 0) {
12985  __pyx_t_23 += __pyx_pybuffernd_elementJacobian.diminfo[2].shape;
12986  if (unlikely(__pyx_t_23 < 0)) __pyx_t_20 = 2;
12987  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_elementJacobian.diminfo[2].shape)) __pyx_t_20 = 2;
12988  if (unlikely(__pyx_t_20 != -1)) {
12989  __Pyx_RaiseBufferIndexError(__pyx_t_20);
12990  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12991  }
12992  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_elementJacobian.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_elementJacobian.diminfo[1].strides, __pyx_t_23, __pyx_pybuffernd_elementJacobian.diminfo[2].strides) += (__pyx_v_weight * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_q_dmt.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_q_dmt.diminfo[1].strides)));
12993 
12994  /* "subsurfaceTransportFunctions.pyx":653
12995  *
12996  * #have to actually compute loop over other nodes for stiffness terms
12997  * for ebN in range(nElementBoundaries_element): #same as nDOF_trial , nElementBoundaries_ # <<<<<<<<<<<<<<
12998  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
12999  * for ii in range(nnz):
13000  */
13001  __pyx_t_20 = __pyx_v_nElementBoundaries_element;
13002  for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_20; __pyx_t_24+=1) {
13003  __pyx_v_ebN = __pyx_t_24;
13004 
13005  /* "subsurfaceTransportFunctions.pyx":655
13006  * for ebN in range(nElementBoundaries_element): #same as nDOF_trial , nElementBoundaries_
13007  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
13008  * for ii in range(nnz): # <<<<<<<<<<<<<<
13009  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
13010  * for I in range(nSpace):
13011  */
13012  __pyx_t_25 = __pyx_v_nnz;
13013  for (__pyx_t_26 = 0; __pyx_t_26 < __pyx_t_25; __pyx_t_26+=1) {
13014  __pyx_v_ii = __pyx_t_26;
13015 
13016  /* "subsurfaceTransportFunctions.pyx":656
13017  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
13018  * for ii in range(nnz):
13019  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN] # <<<<<<<<<<<<<<
13020  * for I in range(nSpace):
13021  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN]
13022  */
13023  __pyx_t_27 = __pyx_v_eN;
13024  __pyx_t_28 = __pyx_v_ebN;
13025  __pyx_t_29 = __pyx_v_ii;
13026  __pyx_t_30 = -1;
13027  if (__pyx_t_27 < 0) {
13028  __pyx_t_27 += __pyx_pybuffernd_q_alin.diminfo[0].shape;
13029  if (unlikely(__pyx_t_27 < 0)) __pyx_t_30 = 0;
13030  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_q_alin.diminfo[0].shape)) __pyx_t_30 = 0;
13031  if (__pyx_t_28 < 0) {
13032  __pyx_t_28 += __pyx_pybuffernd_q_alin.diminfo[1].shape;
13033  if (unlikely(__pyx_t_28 < 0)) __pyx_t_30 = 1;
13034  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_q_alin.diminfo[1].shape)) __pyx_t_30 = 1;
13035  if (__pyx_t_29 < 0) {
13036  __pyx_t_29 += __pyx_pybuffernd_q_alin.diminfo[2].shape;
13037  if (unlikely(__pyx_t_29 < 0)) __pyx_t_30 = 2;
13038  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_q_alin.diminfo[2].shape)) __pyx_t_30 = 2;
13039  if (unlikely(__pyx_t_30 != -1)) {
13040  __Pyx_RaiseBufferIndexError(__pyx_t_30);
13041  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13042  }
13043  __pyx_t_31 = __pyx_v_eN;
13044  __pyx_t_32 = __pyx_v_ebN;
13045  __pyx_t_30 = -1;
13046  if (__pyx_t_31 < 0) {
13047  __pyx_t_31 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
13048  if (unlikely(__pyx_t_31 < 0)) __pyx_t_30 = 0;
13049  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_30 = 0;
13050  if (__pyx_t_32 < 0) {
13051  __pyx_t_32 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
13052  if (unlikely(__pyx_t_32 < 0)) __pyx_t_30 = 1;
13053  } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_30 = 1;
13054  if (unlikely(__pyx_t_30 != -1)) {
13055  __Pyx_RaiseBufferIndexError(__pyx_t_30);
13056  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13057  }
13058  __pyx_t_33 = __pyx_v_ii;
13059  __pyx_t_30 = -1;
13060  if (__pyx_t_33 < 0) {
13061  __pyx_t_33 += __pyx_pybuffernd_a_up.diminfo[0].shape;
13062  if (unlikely(__pyx_t_33 < 0)) __pyx_t_30 = 0;
13063  } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_a_up.diminfo[0].shape)) __pyx_t_30 = 0;
13064  if (unlikely(__pyx_t_30 != -1)) {
13065  __Pyx_RaiseBufferIndexError(__pyx_t_30);
13066  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13067  }
13068  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_a_up.diminfo[0].strides) = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_q_alin.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_q_alin.diminfo[1].strides, __pyx_t_29, __pyx_pybuffernd_q_alin.diminfo[2].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_q_kr_up.diminfo[1].strides)));
13069  }
13070 
13071  /* "subsurfaceTransportFunctions.pyx":657
13072  * for ii in range(nnz):
13073  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
13074  * for I in range(nSpace): # <<<<<<<<<<<<<<
13075  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN]
13076  * #
13077  */
13078  __pyx_t_25 = __pyx_v_nSpace;
13079  for (__pyx_t_26 = 0; __pyx_t_26 < __pyx_t_25; __pyx_t_26+=1) {
13080  __pyx_v_I = __pyx_t_26;
13081 
13082  /* "subsurfaceTransportFunctions.pyx":658
13083  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
13084  * for I in range(nSpace):
13085  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN] # <<<<<<<<<<<<<<
13086  * #
13087  *
13088  */
13089  __pyx_t_34 = __pyx_v_eN;
13090  __pyx_t_35 = __pyx_v_ebN;
13091  __pyx_t_36 = __pyx_v_I;
13092  __pyx_t_30 = -1;
13093  if (__pyx_t_34 < 0) {
13094  __pyx_t_34 += __pyx_pybuffernd_q_flin.diminfo[0].shape;
13095  if (unlikely(__pyx_t_34 < 0)) __pyx_t_30 = 0;
13096  } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_q_flin.diminfo[0].shape)) __pyx_t_30 = 0;
13097  if (__pyx_t_35 < 0) {
13098  __pyx_t_35 += __pyx_pybuffernd_q_flin.diminfo[1].shape;
13099  if (unlikely(__pyx_t_35 < 0)) __pyx_t_30 = 1;
13100  } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_q_flin.diminfo[1].shape)) __pyx_t_30 = 1;
13101  if (__pyx_t_36 < 0) {
13102  __pyx_t_36 += __pyx_pybuffernd_q_flin.diminfo[2].shape;
13103  if (unlikely(__pyx_t_36 < 0)) __pyx_t_30 = 2;
13104  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_q_flin.diminfo[2].shape)) __pyx_t_30 = 2;
13105  if (unlikely(__pyx_t_30 != -1)) {
13106  __Pyx_RaiseBufferIndexError(__pyx_t_30);
13107  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13108  }
13109  __pyx_t_37 = __pyx_v_eN;
13110  __pyx_t_38 = __pyx_v_ebN;
13111  __pyx_t_30 = -1;
13112  if (__pyx_t_37 < 0) {
13113  __pyx_t_37 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
13114  if (unlikely(__pyx_t_37 < 0)) __pyx_t_30 = 0;
13115  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_30 = 0;
13116  if (__pyx_t_38 < 0) {
13117  __pyx_t_38 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
13118  if (unlikely(__pyx_t_38 < 0)) __pyx_t_30 = 1;
13119  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_30 = 1;
13120  if (unlikely(__pyx_t_30 != -1)) {
13121  __Pyx_RaiseBufferIndexError(__pyx_t_30);
13122  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13123  }
13124  __pyx_t_39 = __pyx_v_I;
13125  __pyx_t_30 = -1;
13126  if (__pyx_t_39 < 0) {
13127  __pyx_t_39 += __pyx_pybuffernd_f_up.diminfo[0].shape;
13128  if (unlikely(__pyx_t_39 < 0)) __pyx_t_30 = 0;
13129  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_f_up.diminfo[0].shape)) __pyx_t_30 = 0;
13130  if (unlikely(__pyx_t_30 != -1)) {
13131  __Pyx_RaiseBufferIndexError(__pyx_t_30);
13132  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13133  }
13134  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_f_up.diminfo[0].strides) = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_q_flin.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_q_flin.diminfo[1].strides, __pyx_t_36, __pyx_pybuffernd_q_flin.diminfo[2].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_q_kr_up.diminfo[1].strides)));
13135  }
13136 
13137  /* "subsurfaceTransportFunctions.pyx":662
13138  *
13139  * #Picard part first
13140  * for j in range(nDOF_trial_element): # <<<<<<<<<<<<<<
13141  * for I in range(nSpace):
13142  * for ii in range(rowptr[I],rowptr[I+1]):
13143  */
13144  __pyx_t_25 = __pyx_v_nDOF_trial_element;
13145  for (__pyx_t_26 = 0; __pyx_t_26 < __pyx_t_25; __pyx_t_26+=1) {
13146  __pyx_v_j = __pyx_t_26;
13147 
13148  /* "subsurfaceTransportFunctions.pyx":663
13149  * #Picard part first
13150  * for j in range(nDOF_trial_element):
13151  * for I in range(nSpace): # <<<<<<<<<<<<<<
13152  * for ii in range(rowptr[I],rowptr[I+1]):
13153  * elementJacobian[eN,i,j] += weight*a_up[ii]*q_grad_v[eN,ebN,j,colind[ii]]*q_grad_w[eN,ebN,i,I]
13154  */
13155  __pyx_t_30 = __pyx_v_nSpace;
13156  for (__pyx_t_40 = 0; __pyx_t_40 < __pyx_t_30; __pyx_t_40+=1) {
13157  __pyx_v_I = __pyx_t_40;
13158 
13159  /* "subsurfaceTransportFunctions.pyx":664
13160  * for j in range(nDOF_trial_element):
13161  * for I in range(nSpace):
13162  * for ii in range(rowptr[I],rowptr[I+1]): # <<<<<<<<<<<<<<
13163  * elementJacobian[eN,i,j] += weight*a_up[ii]*q_grad_v[eN,ebN,j,colind[ii]]*q_grad_w[eN,ebN,i,I]
13164  * #j picard
13165  */
13166  __pyx_t_41 = (__pyx_v_I + 1);
13167  __pyx_t_42 = -1;
13168  if (__pyx_t_41 < 0) {
13169  __pyx_t_41 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
13170  if (unlikely(__pyx_t_41 < 0)) __pyx_t_42 = 0;
13171  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_42 = 0;
13172  if (unlikely(__pyx_t_42 != -1)) {
13173  __Pyx_RaiseBufferIndexError(__pyx_t_42);
13174  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13175  }
13176  __pyx_t_43 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_rowptr.diminfo[0].strides));
13177  __pyx_t_44 = __pyx_v_I;
13178  __pyx_t_42 = -1;
13179  if (__pyx_t_44 < 0) {
13180  __pyx_t_44 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
13181  if (unlikely(__pyx_t_44 < 0)) __pyx_t_42 = 0;
13182  } else if (unlikely(__pyx_t_44 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_42 = 0;
13183  if (unlikely(__pyx_t_42 != -1)) {
13184  __Pyx_RaiseBufferIndexError(__pyx_t_42);
13185  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13186  }
13187  for (__pyx_t_42 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_rowptr.diminfo[0].strides)); __pyx_t_42 < __pyx_t_43; __pyx_t_42+=1) {
13188  __pyx_v_ii = __pyx_t_42;
13189 
13190  /* "subsurfaceTransportFunctions.pyx":665
13191  * for I in range(nSpace):
13192  * for ii in range(rowptr[I],rowptr[I+1]):
13193  * elementJacobian[eN,i,j] += weight*a_up[ii]*q_grad_v[eN,ebN,j,colind[ii]]*q_grad_w[eN,ebN,i,I] # <<<<<<<<<<<<<<
13194  * #j picard
13195  * #i
13196  */
13197  __pyx_t_45 = __pyx_v_ii;
13198  __pyx_t_46 = -1;
13199  if (__pyx_t_45 < 0) {
13200  __pyx_t_45 += __pyx_pybuffernd_a_up.diminfo[0].shape;
13201  if (unlikely(__pyx_t_45 < 0)) __pyx_t_46 = 0;
13202  } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_a_up.diminfo[0].shape)) __pyx_t_46 = 0;
13203  if (unlikely(__pyx_t_46 != -1)) {
13204  __Pyx_RaiseBufferIndexError(__pyx_t_46);
13205  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13206  }
13207  __pyx_t_47 = __pyx_v_ii;
13208  __pyx_t_46 = -1;
13209  if (__pyx_t_47 < 0) {
13210  __pyx_t_47 += __pyx_pybuffernd_colind.diminfo[0].shape;
13211  if (unlikely(__pyx_t_47 < 0)) __pyx_t_46 = 0;
13212  } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_colind.diminfo[0].shape)) __pyx_t_46 = 0;
13213  if (unlikely(__pyx_t_46 != -1)) {
13214  __Pyx_RaiseBufferIndexError(__pyx_t_46);
13215  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13216  }
13217  __pyx_t_48 = __pyx_v_eN;
13218  __pyx_t_49 = __pyx_v_ebN;
13219  __pyx_t_50 = __pyx_v_j;
13220  __pyx_t_51 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_colind.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_colind.diminfo[0].strides));
13221  __pyx_t_46 = -1;
13222  if (__pyx_t_48 < 0) {
13223  __pyx_t_48 += __pyx_pybuffernd_q_grad_v.diminfo[0].shape;
13224  if (unlikely(__pyx_t_48 < 0)) __pyx_t_46 = 0;
13225  } else if (unlikely(__pyx_t_48 >= __pyx_pybuffernd_q_grad_v.diminfo[0].shape)) __pyx_t_46 = 0;
13226  if (__pyx_t_49 < 0) {
13227  __pyx_t_49 += __pyx_pybuffernd_q_grad_v.diminfo[1].shape;
13228  if (unlikely(__pyx_t_49 < 0)) __pyx_t_46 = 1;
13229  } else if (unlikely(__pyx_t_49 >= __pyx_pybuffernd_q_grad_v.diminfo[1].shape)) __pyx_t_46 = 1;
13230  if (__pyx_t_50 < 0) {
13231  __pyx_t_50 += __pyx_pybuffernd_q_grad_v.diminfo[2].shape;
13232  if (unlikely(__pyx_t_50 < 0)) __pyx_t_46 = 2;
13233  } else if (unlikely(__pyx_t_50 >= __pyx_pybuffernd_q_grad_v.diminfo[2].shape)) __pyx_t_46 = 2;
13234  if (__pyx_t_51 < 0) {
13235  __pyx_t_51 += __pyx_pybuffernd_q_grad_v.diminfo[3].shape;
13236  if (unlikely(__pyx_t_51 < 0)) __pyx_t_46 = 3;
13237  } else if (unlikely(__pyx_t_51 >= __pyx_pybuffernd_q_grad_v.diminfo[3].shape)) __pyx_t_46 = 3;
13238  if (unlikely(__pyx_t_46 != -1)) {
13239  __Pyx_RaiseBufferIndexError(__pyx_t_46);
13240  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13241  }
13242  __pyx_t_52 = __pyx_v_eN;
13243  __pyx_t_53 = __pyx_v_ebN;
13244  __pyx_t_54 = __pyx_v_i;
13245  __pyx_t_55 = __pyx_v_I;
13246  __pyx_t_46 = -1;
13247  if (__pyx_t_52 < 0) {
13248  __pyx_t_52 += __pyx_pybuffernd_q_grad_w.diminfo[0].shape;
13249  if (unlikely(__pyx_t_52 < 0)) __pyx_t_46 = 0;
13250  } else if (unlikely(__pyx_t_52 >= __pyx_pybuffernd_q_grad_w.diminfo[0].shape)) __pyx_t_46 = 0;
13251  if (__pyx_t_53 < 0) {
13252  __pyx_t_53 += __pyx_pybuffernd_q_grad_w.diminfo[1].shape;
13253  if (unlikely(__pyx_t_53 < 0)) __pyx_t_46 = 1;
13254  } else if (unlikely(__pyx_t_53 >= __pyx_pybuffernd_q_grad_w.diminfo[1].shape)) __pyx_t_46 = 1;
13255  if (__pyx_t_54 < 0) {
13256  __pyx_t_54 += __pyx_pybuffernd_q_grad_w.diminfo[2].shape;
13257  if (unlikely(__pyx_t_54 < 0)) __pyx_t_46 = 2;
13258  } else if (unlikely(__pyx_t_54 >= __pyx_pybuffernd_q_grad_w.diminfo[2].shape)) __pyx_t_46 = 2;
13259  if (__pyx_t_55 < 0) {
13260  __pyx_t_55 += __pyx_pybuffernd_q_grad_w.diminfo[3].shape;
13261  if (unlikely(__pyx_t_55 < 0)) __pyx_t_46 = 3;
13262  } else if (unlikely(__pyx_t_55 >= __pyx_pybuffernd_q_grad_w.diminfo[3].shape)) __pyx_t_46 = 3;
13263  if (unlikely(__pyx_t_46 != -1)) {
13264  __Pyx_RaiseBufferIndexError(__pyx_t_46);
13265  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13266  }
13267  __pyx_t_56 = __pyx_v_eN;
13268  __pyx_t_57 = __pyx_v_i;
13269  __pyx_t_58 = __pyx_v_j;
13270  __pyx_t_46 = -1;
13271  if (__pyx_t_56 < 0) {
13272  __pyx_t_56 += __pyx_pybuffernd_elementJacobian.diminfo[0].shape;
13273  if (unlikely(__pyx_t_56 < 0)) __pyx_t_46 = 0;
13274  } else if (unlikely(__pyx_t_56 >= __pyx_pybuffernd_elementJacobian.diminfo[0].shape)) __pyx_t_46 = 0;
13275  if (__pyx_t_57 < 0) {
13276  __pyx_t_57 += __pyx_pybuffernd_elementJacobian.diminfo[1].shape;
13277  if (unlikely(__pyx_t_57 < 0)) __pyx_t_46 = 1;
13278  } else if (unlikely(__pyx_t_57 >= __pyx_pybuffernd_elementJacobian.diminfo[1].shape)) __pyx_t_46 = 1;
13279  if (__pyx_t_58 < 0) {
13280  __pyx_t_58 += __pyx_pybuffernd_elementJacobian.diminfo[2].shape;
13281  if (unlikely(__pyx_t_58 < 0)) __pyx_t_46 = 2;
13282  } else if (unlikely(__pyx_t_58 >= __pyx_pybuffernd_elementJacobian.diminfo[2].shape)) __pyx_t_46 = 2;
13283  if (unlikely(__pyx_t_46 != -1)) {
13284  __Pyx_RaiseBufferIndexError(__pyx_t_46);
13285  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13286  }
13287  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.buf, __pyx_t_56, __pyx_pybuffernd_elementJacobian.diminfo[0].strides, __pyx_t_57, __pyx_pybuffernd_elementJacobian.diminfo[1].strides, __pyx_t_58, __pyx_pybuffernd_elementJacobian.diminfo[2].strides) += (((__pyx_v_weight * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_a_up.diminfo[0].strides))) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_q_grad_v.diminfo[0].strides, __pyx_t_49, __pyx_pybuffernd_q_grad_v.diminfo[1].strides, __pyx_t_50, __pyx_pybuffernd_q_grad_v.diminfo[2].strides, __pyx_t_51, __pyx_pybuffernd_q_grad_v.diminfo[3].strides))) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.buf, __pyx_t_52, __pyx_pybuffernd_q_grad_w.diminfo[0].strides, __pyx_t_53, __pyx_pybuffernd_q_grad_w.diminfo[1].strides, __pyx_t_54, __pyx_pybuffernd_q_grad_w.diminfo[2].strides, __pyx_t_55, __pyx_pybuffernd_q_grad_w.diminfo[3].strides)));
13288  }
13289  }
13290  }
13291  }
13292  }
13293  }
13294 
13295  /* "subsurfaceTransportFunctions.pyx":574
13296  * #i
13297  * #eN
13298  * def RE_NCP1_getElementJacobian(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
13299  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
13300  * numpy.ndarray[ITYPE_t,ndim=1] colind,
13301  */
13302 
13303  /* function exit code */
13304  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
13305  goto __pyx_L0;
13306  __pyx_L1_error:;
13307  __Pyx_XDECREF(__pyx_t_1);
13308  __Pyx_XDECREF(__pyx_t_2);
13309  __Pyx_XDECREF(__pyx_t_4);
13310  __Pyx_XDECREF(__pyx_t_5);
13311  __Pyx_XDECREF(__pyx_t_9);
13312  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
13313  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
13314  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer);
13315  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
13316  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
13317  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer);
13318  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
13319  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer);
13320  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
13321  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
13322  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer);
13323  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer);
13324  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dm.rcbuffer->pybuffer);
13325  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dmt.rcbuffer->pybuffer);
13326  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
13327  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer);
13328  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer);
13329  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer);
13330  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
13331  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
13332  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer);
13333  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer);
13334  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
13335  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
13336  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
13337  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
13338  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_getElementJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
13339  __pyx_r = NULL;
13340  goto __pyx_L2;
13341  __pyx_L0:;
13342  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer);
13343  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
13344  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
13345  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer);
13346  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
13347  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer);
13348  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
13349  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
13350  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer);
13351  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer);
13352  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dm.rcbuffer->pybuffer);
13353  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dmt.rcbuffer->pybuffer);
13354  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
13355  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer);
13356  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer);
13357  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer);
13358  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
13359  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
13360  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer);
13361  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer);
13362  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
13363  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
13364  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
13365  __pyx_L2:;
13366  __Pyx_XDECREF(__pyx_v_q);
13367  __Pyx_XDECREF((PyObject *)__pyx_v_a_up);
13368  __Pyx_XDECREF((PyObject *)__pyx_v_f_up);
13369  __Pyx_XGIVEREF(__pyx_r);
13370  __Pyx_RefNannyFinishContext();
13371  return __pyx_r;
13372 }
13373 
13374 /* "subsurfaceTransportFunctions.pyx":673
13375  * ##################################################
13376  *
13377  * def updateMass_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] mt, # <<<<<<<<<<<<<<
13378  * numpy.ndarray[DTYPE_t,ndim=3] w,
13379  * numpy.ndarray[DTYPE_t,ndim=2] dV,
13380  */
13381 
13382 /* Python wrapper */
13383 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_37updateMass_weakAvg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
13384 static char __pyx_doc_28subsurfaceTransportFunctions_36updateMass_weakAvg[] = "\n approximate element mass term as (\010ar{c}_e,w_{h,i})_e\n ";
13385 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_37updateMass_weakAvg = {"updateMass_weakAvg", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_37updateMass_weakAvg, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_36updateMass_weakAvg};
13386 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_37updateMass_weakAvg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
13387  PyArrayObject *__pyx_v_mt = 0;
13388  PyArrayObject *__pyx_v_w = 0;
13389  PyArrayObject *__pyx_v_dV = 0;
13390  PyArrayObject *__pyx_v_weak_residual = 0;
13391  int __pyx_lineno = 0;
13392  const char *__pyx_filename = NULL;
13393  int __pyx_clineno = 0;
13394  PyObject *__pyx_r = 0;
13395  __Pyx_RefNannyDeclarations
13396  __Pyx_RefNannySetupContext("updateMass_weakAvg (wrapper)", 0);
13397  {
13398  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mt,&__pyx_n_s_w,&__pyx_n_s_dV,&__pyx_n_s_weak_residual,0};
13399  PyObject* values[4] = {0,0,0,0};
13400  if (unlikely(__pyx_kwds)) {
13401  Py_ssize_t kw_args;
13402  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
13403  switch (pos_args) {
13404  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
13405  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
13406  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
13407  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13408  case 0: break;
13409  default: goto __pyx_L5_argtuple_error;
13410  }
13411  kw_args = PyDict_Size(__pyx_kwds);
13412  switch (pos_args) {
13413  case 0:
13414  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mt)) != 0)) kw_args--;
13415  else goto __pyx_L5_argtuple_error;
13416  case 1:
13417  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
13418  else {
13419  __Pyx_RaiseArgtupleInvalid("updateMass_weakAvg", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
13420  }
13421  case 2:
13422  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dV)) != 0)) kw_args--;
13423  else {
13424  __Pyx_RaiseArgtupleInvalid("updateMass_weakAvg", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
13425  }
13426  case 3:
13427  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_weak_residual)) != 0)) kw_args--;
13428  else {
13429  __Pyx_RaiseArgtupleInvalid("updateMass_weakAvg", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
13430  }
13431  }
13432  if (unlikely(kw_args > 0)) {
13433  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "updateMass_weakAvg") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
13434  }
13435  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
13436  goto __pyx_L5_argtuple_error;
13437  } else {
13438  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13439  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
13440  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
13441  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
13442  }
13443  __pyx_v_mt = ((PyArrayObject *)values[0]);
13444  __pyx_v_w = ((PyArrayObject *)values[1]);
13445  __pyx_v_dV = ((PyArrayObject *)values[2]);
13446  __pyx_v_weak_residual = ((PyArrayObject *)values[3]);
13447  }
13448  goto __pyx_L4_argument_unpacking_done;
13449  __pyx_L5_argtuple_error:;
13450  __Pyx_RaiseArgtupleInvalid("updateMass_weakAvg", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
13451  __pyx_L3_error:;
13452  __Pyx_AddTraceback("subsurfaceTransportFunctions.updateMass_weakAvg", __pyx_clineno, __pyx_lineno, __pyx_filename);
13453  __Pyx_RefNannyFinishContext();
13454  return NULL;
13455  __pyx_L4_argument_unpacking_done:;
13456  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mt), __pyx_ptype_5numpy_ndarray, 1, "mt", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13457  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_5numpy_ndarray, 1, "w", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13458  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dV), __pyx_ptype_5numpy_ndarray, 1, "dV", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13459  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weak_residual), __pyx_ptype_5numpy_ndarray, 1, "weak_residual", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13460  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_36updateMass_weakAvg(__pyx_self, __pyx_v_mt, __pyx_v_w, __pyx_v_dV, __pyx_v_weak_residual);
13461 
13462  /* function exit code */
13463  goto __pyx_L0;
13464  __pyx_L1_error:;
13465  __pyx_r = NULL;
13466  __pyx_L0:;
13467  __Pyx_RefNannyFinishContext();
13468  return __pyx_r;
13469 }
13470 
13471 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_36updateMass_weakAvg(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_mt, PyArrayObject *__pyx_v_w, PyArrayObject *__pyx_v_dV, PyArrayObject *__pyx_v_weak_residual) {
13472  int __pyx_v_eN;
13473  int __pyx_v_i;
13474  int __pyx_v_k;
13475  PyObject *__pyx_v_mt_avg = 0;
13476  PyObject *__pyx_v_vol = 0;
13477  __Pyx_LocalBuf_ND __pyx_pybuffernd_dV;
13478  __Pyx_Buffer __pyx_pybuffer_dV;
13479  __Pyx_LocalBuf_ND __pyx_pybuffernd_mt;
13480  __Pyx_Buffer __pyx_pybuffer_mt;
13481  __Pyx_LocalBuf_ND __pyx_pybuffernd_w;
13482  __Pyx_Buffer __pyx_pybuffer_w;
13483  __Pyx_LocalBuf_ND __pyx_pybuffernd_weak_residual;
13484  __Pyx_Buffer __pyx_pybuffer_weak_residual;
13485  PyObject *__pyx_r = NULL;
13486  __Pyx_RefNannyDeclarations
13487  npy_intp __pyx_t_1;
13488  int __pyx_t_2;
13489  npy_intp __pyx_t_3;
13490  int __pyx_t_4;
13491  Py_ssize_t __pyx_t_5;
13492  Py_ssize_t __pyx_t_6;
13493  int __pyx_t_7;
13494  Py_ssize_t __pyx_t_8;
13495  Py_ssize_t __pyx_t_9;
13496  PyObject *__pyx_t_10 = NULL;
13497  PyObject *__pyx_t_11 = NULL;
13498  Py_ssize_t __pyx_t_12;
13499  Py_ssize_t __pyx_t_13;
13500  Py_ssize_t __pyx_t_14;
13501  Py_ssize_t __pyx_t_15;
13502  Py_ssize_t __pyx_t_16;
13503  Py_ssize_t __pyx_t_17;
13504  Py_ssize_t __pyx_t_18;
13505  PyObject *__pyx_t_19 = NULL;
13506  double __pyx_t_20;
13507  Py_ssize_t __pyx_t_21;
13508  Py_ssize_t __pyx_t_22;
13509  int __pyx_lineno = 0;
13510  const char *__pyx_filename = NULL;
13511  int __pyx_clineno = 0;
13512  __Pyx_RefNannySetupContext("updateMass_weakAvg", 0);
13513  __pyx_pybuffer_mt.pybuffer.buf = NULL;
13514  __pyx_pybuffer_mt.refcount = 0;
13515  __pyx_pybuffernd_mt.data = NULL;
13516  __pyx_pybuffernd_mt.rcbuffer = &__pyx_pybuffer_mt;
13517  __pyx_pybuffer_w.pybuffer.buf = NULL;
13518  __pyx_pybuffer_w.refcount = 0;
13519  __pyx_pybuffernd_w.data = NULL;
13520  __pyx_pybuffernd_w.rcbuffer = &__pyx_pybuffer_w;
13521  __pyx_pybuffer_dV.pybuffer.buf = NULL;
13522  __pyx_pybuffer_dV.refcount = 0;
13523  __pyx_pybuffernd_dV.data = NULL;
13524  __pyx_pybuffernd_dV.rcbuffer = &__pyx_pybuffer_dV;
13525  __pyx_pybuffer_weak_residual.pybuffer.buf = NULL;
13526  __pyx_pybuffer_weak_residual.refcount = 0;
13527  __pyx_pybuffernd_weak_residual.data = NULL;
13528  __pyx_pybuffernd_weak_residual.rcbuffer = &__pyx_pybuffer_weak_residual;
13529  {
13530  __Pyx_BufFmt_StackElem __pyx_stack[1];
13531  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mt.rcbuffer->pybuffer, (PyObject*)__pyx_v_mt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13532  }
13533  __pyx_pybuffernd_mt.diminfo[0].strides = __pyx_pybuffernd_mt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mt.diminfo[0].shape = __pyx_pybuffernd_mt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mt.diminfo[1].strides = __pyx_pybuffernd_mt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mt.diminfo[1].shape = __pyx_pybuffernd_mt.rcbuffer->pybuffer.shape[1];
13534  {
13535  __Pyx_BufFmt_StackElem __pyx_stack[1];
13536  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_w, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13537  }
13538  __pyx_pybuffernd_w.diminfo[0].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_w.diminfo[0].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_w.diminfo[1].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_w.diminfo[1].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_w.diminfo[2].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_w.diminfo[2].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[2];
13539  {
13540  __Pyx_BufFmt_StackElem __pyx_stack[1];
13541  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_v_dV, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13542  }
13543  __pyx_pybuffernd_dV.diminfo[0].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dV.diminfo[0].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dV.diminfo[1].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dV.diminfo[1].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[1];
13544  {
13545  __Pyx_BufFmt_StackElem __pyx_stack[1];
13546  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weak_residual.rcbuffer->pybuffer, (PyObject*)__pyx_v_weak_residual, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13547  }
13548  __pyx_pybuffernd_weak_residual.diminfo[0].strides = __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weak_residual.diminfo[0].shape = __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_weak_residual.diminfo[1].strides = __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_weak_residual.diminfo[1].shape = __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.shape[1];
13549 
13550  /* "subsurfaceTransportFunctions.pyx":682
13551  * cdef int eN,i,k
13552  * cdef mt_avg,vol
13553  * for eN in range(mt.shape[0]): # <<<<<<<<<<<<<<
13554  * mt_avg = 0.0
13555  * vol = 0.0
13556  */
13557  __pyx_t_1 = (__pyx_v_mt->dimensions[0]);
13558  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
13559  __pyx_v_eN = __pyx_t_2;
13560 
13561  /* "subsurfaceTransportFunctions.pyx":683
13562  * cdef mt_avg,vol
13563  * for eN in range(mt.shape[0]):
13564  * mt_avg = 0.0 # <<<<<<<<<<<<<<
13565  * vol = 0.0
13566  * for k in range(mt.shape[1]):
13567  */
13568  __Pyx_INCREF(__pyx_float_0_0);
13569  __Pyx_XDECREF_SET(__pyx_v_mt_avg, __pyx_float_0_0);
13570 
13571  /* "subsurfaceTransportFunctions.pyx":684
13572  * for eN in range(mt.shape[0]):
13573  * mt_avg = 0.0
13574  * vol = 0.0 # <<<<<<<<<<<<<<
13575  * for k in range(mt.shape[1]):
13576  * mt_avg += dV[eN,k]*mt[eN,k]
13577  */
13578  __Pyx_INCREF(__pyx_float_0_0);
13579  __Pyx_XDECREF_SET(__pyx_v_vol, __pyx_float_0_0);
13580 
13581  /* "subsurfaceTransportFunctions.pyx":685
13582  * mt_avg = 0.0
13583  * vol = 0.0
13584  * for k in range(mt.shape[1]): # <<<<<<<<<<<<<<
13585  * mt_avg += dV[eN,k]*mt[eN,k]
13586  * vol += dV[eN,k]
13587  */
13588  __pyx_t_3 = (__pyx_v_mt->dimensions[1]);
13589  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
13590  __pyx_v_k = __pyx_t_4;
13591 
13592  /* "subsurfaceTransportFunctions.pyx":686
13593  * vol = 0.0
13594  * for k in range(mt.shape[1]):
13595  * mt_avg += dV[eN,k]*mt[eN,k] # <<<<<<<<<<<<<<
13596  * vol += dV[eN,k]
13597  * mt_avg /= vol
13598  */
13599  __pyx_t_5 = __pyx_v_eN;
13600  __pyx_t_6 = __pyx_v_k;
13601  __pyx_t_7 = -1;
13602  if (__pyx_t_5 < 0) {
13603  __pyx_t_5 += __pyx_pybuffernd_dV.diminfo[0].shape;
13604  if (unlikely(__pyx_t_5 < 0)) __pyx_t_7 = 0;
13605  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_7 = 0;
13606  if (__pyx_t_6 < 0) {
13607  __pyx_t_6 += __pyx_pybuffernd_dV.diminfo[1].shape;
13608  if (unlikely(__pyx_t_6 < 0)) __pyx_t_7 = 1;
13609  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_7 = 1;
13610  if (unlikely(__pyx_t_7 != -1)) {
13611  __Pyx_RaiseBufferIndexError(__pyx_t_7);
13612  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13613  }
13614  __pyx_t_8 = __pyx_v_eN;
13615  __pyx_t_9 = __pyx_v_k;
13616  __pyx_t_7 = -1;
13617  if (__pyx_t_8 < 0) {
13618  __pyx_t_8 += __pyx_pybuffernd_mt.diminfo[0].shape;
13619  if (unlikely(__pyx_t_8 < 0)) __pyx_t_7 = 0;
13620  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_mt.diminfo[0].shape)) __pyx_t_7 = 0;
13621  if (__pyx_t_9 < 0) {
13622  __pyx_t_9 += __pyx_pybuffernd_mt.diminfo[1].shape;
13623  if (unlikely(__pyx_t_9 < 0)) __pyx_t_7 = 1;
13624  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_mt.diminfo[1].shape)) __pyx_t_7 = 1;
13625  if (unlikely(__pyx_t_7 != -1)) {
13626  __Pyx_RaiseBufferIndexError(__pyx_t_7);
13627  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13628  }
13629  __pyx_t_10 = PyFloat_FromDouble(((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_dV.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_mt.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_mt.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_mt.diminfo[1].strides)))); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13630  __Pyx_GOTREF(__pyx_t_10);
13631  __pyx_t_11 = PyNumber_InPlaceAdd(__pyx_v_mt_avg, __pyx_t_10); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13632  __Pyx_GOTREF(__pyx_t_11);
13633  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
13634  __Pyx_DECREF_SET(__pyx_v_mt_avg, __pyx_t_11);
13635  __pyx_t_11 = 0;
13636 
13637  /* "subsurfaceTransportFunctions.pyx":687
13638  * for k in range(mt.shape[1]):
13639  * mt_avg += dV[eN,k]*mt[eN,k]
13640  * vol += dV[eN,k] # <<<<<<<<<<<<<<
13641  * mt_avg /= vol
13642  * for i in range(weak_residual.shape[1]):
13643  */
13644  __pyx_t_12 = __pyx_v_eN;
13645  __pyx_t_13 = __pyx_v_k;
13646  __pyx_t_7 = -1;
13647  if (__pyx_t_12 < 0) {
13648  __pyx_t_12 += __pyx_pybuffernd_dV.diminfo[0].shape;
13649  if (unlikely(__pyx_t_12 < 0)) __pyx_t_7 = 0;
13650  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_7 = 0;
13651  if (__pyx_t_13 < 0) {
13652  __pyx_t_13 += __pyx_pybuffernd_dV.diminfo[1].shape;
13653  if (unlikely(__pyx_t_13 < 0)) __pyx_t_7 = 1;
13654  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_7 = 1;
13655  if (unlikely(__pyx_t_7 != -1)) {
13656  __Pyx_RaiseBufferIndexError(__pyx_t_7);
13657  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13658  }
13659  __pyx_t_11 = PyFloat_FromDouble((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_dV.diminfo[1].strides))); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13660  __Pyx_GOTREF(__pyx_t_11);
13661  __pyx_t_10 = PyNumber_InPlaceAdd(__pyx_v_vol, __pyx_t_11); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13662  __Pyx_GOTREF(__pyx_t_10);
13663  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
13664  __Pyx_DECREF_SET(__pyx_v_vol, __pyx_t_10);
13665  __pyx_t_10 = 0;
13666  }
13667 
13668  /* "subsurfaceTransportFunctions.pyx":688
13669  * mt_avg += dV[eN,k]*mt[eN,k]
13670  * vol += dV[eN,k]
13671  * mt_avg /= vol # <<<<<<<<<<<<<<
13672  * for i in range(weak_residual.shape[1]):
13673  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
13674  */
13675  __pyx_t_10 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_mt_avg, __pyx_v_vol); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13676  __Pyx_GOTREF(__pyx_t_10);
13677  __Pyx_DECREF_SET(__pyx_v_mt_avg, __pyx_t_10);
13678  __pyx_t_10 = 0;
13679 
13680  /* "subsurfaceTransportFunctions.pyx":689
13681  * vol += dV[eN,k]
13682  * mt_avg /= vol
13683  * for i in range(weak_residual.shape[1]): # <<<<<<<<<<<<<<
13684  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
13685  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
13686  */
13687  __pyx_t_3 = (__pyx_v_weak_residual->dimensions[1]);
13688  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
13689  __pyx_v_i = __pyx_t_4;
13690 
13691  /* "subsurfaceTransportFunctions.pyx":691
13692  * for i in range(weak_residual.shape[1]):
13693  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
13694  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k]) # <<<<<<<<<<<<<<
13695  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt,
13696  * numpy.ndarray[DTYPE_t,ndim=3] w,
13697  */
13698  __pyx_t_14 = __pyx_v_eN;
13699  __pyx_t_15 = __pyx_v_k;
13700  __pyx_t_16 = __pyx_v_i;
13701  __pyx_t_7 = -1;
13702  if (__pyx_t_14 < 0) {
13703  __pyx_t_14 += __pyx_pybuffernd_w.diminfo[0].shape;
13704  if (unlikely(__pyx_t_14 < 0)) __pyx_t_7 = 0;
13705  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_w.diminfo[0].shape)) __pyx_t_7 = 0;
13706  if (__pyx_t_15 < 0) {
13707  __pyx_t_15 += __pyx_pybuffernd_w.diminfo[1].shape;
13708  if (unlikely(__pyx_t_15 < 0)) __pyx_t_7 = 1;
13709  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_w.diminfo[1].shape)) __pyx_t_7 = 1;
13710  if (__pyx_t_16 < 0) {
13711  __pyx_t_16 += __pyx_pybuffernd_w.diminfo[2].shape;
13712  if (unlikely(__pyx_t_16 < 0)) __pyx_t_7 = 2;
13713  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_w.diminfo[2].shape)) __pyx_t_7 = 2;
13714  if (unlikely(__pyx_t_7 != -1)) {
13715  __Pyx_RaiseBufferIndexError(__pyx_t_7);
13716  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13717  }
13718  __pyx_t_10 = PyFloat_FromDouble((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_w.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_w.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_w.diminfo[1].strides, __pyx_t_16, __pyx_pybuffernd_w.diminfo[2].strides))); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13719  __Pyx_GOTREF(__pyx_t_10);
13720  __pyx_t_11 = PyNumber_Multiply(__pyx_v_mt_avg, __pyx_t_10); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13721  __Pyx_GOTREF(__pyx_t_11);
13722  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
13723  __pyx_t_17 = __pyx_v_eN;
13724  __pyx_t_18 = __pyx_v_k;
13725  __pyx_t_7 = -1;
13726  if (__pyx_t_17 < 0) {
13727  __pyx_t_17 += __pyx_pybuffernd_dV.diminfo[0].shape;
13728  if (unlikely(__pyx_t_17 < 0)) __pyx_t_7 = 0;
13729  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_7 = 0;
13730  if (__pyx_t_18 < 0) {
13731  __pyx_t_18 += __pyx_pybuffernd_dV.diminfo[1].shape;
13732  if (unlikely(__pyx_t_18 < 0)) __pyx_t_7 = 1;
13733  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_7 = 1;
13734  if (unlikely(__pyx_t_7 != -1)) {
13735  __Pyx_RaiseBufferIndexError(__pyx_t_7);
13736  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13737  }
13738  __pyx_t_10 = PyFloat_FromDouble((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_dV.diminfo[1].strides))); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13739  __Pyx_GOTREF(__pyx_t_10);
13740  __pyx_t_19 = PyNumber_Multiply(__pyx_t_11, __pyx_t_10); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13741  __Pyx_GOTREF(__pyx_t_19);
13742  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
13743  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
13744  __pyx_t_20 = __Pyx_PyObject_AsDouble(__pyx_t_19); if (unlikely(__pyx_t_20 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13745  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
13746  __pyx_t_21 = __pyx_v_eN;
13747  __pyx_t_22 = __pyx_v_i;
13748  __pyx_t_7 = -1;
13749  if (__pyx_t_21 < 0) {
13750  __pyx_t_21 += __pyx_pybuffernd_weak_residual.diminfo[0].shape;
13751  if (unlikely(__pyx_t_21 < 0)) __pyx_t_7 = 0;
13752  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_weak_residual.diminfo[0].shape)) __pyx_t_7 = 0;
13753  if (__pyx_t_22 < 0) {
13754  __pyx_t_22 += __pyx_pybuffernd_weak_residual.diminfo[1].shape;
13755  if (unlikely(__pyx_t_22 < 0)) __pyx_t_7 = 1;
13756  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_weak_residual.diminfo[1].shape)) __pyx_t_7 = 1;
13757  if (unlikely(__pyx_t_7 != -1)) {
13758  __Pyx_RaiseBufferIndexError(__pyx_t_7);
13759  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13760  }
13761  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_weak_residual.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_weak_residual.diminfo[1].strides) += __pyx_t_20;
13762  }
13763  }
13764 
13765  /* "subsurfaceTransportFunctions.pyx":673
13766  * ##################################################
13767  *
13768  * def updateMass_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] mt, # <<<<<<<<<<<<<<
13769  * numpy.ndarray[DTYPE_t,ndim=3] w,
13770  * numpy.ndarray[DTYPE_t,ndim=2] dV,
13771  */
13772 
13773  /* function exit code */
13774  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
13775  goto __pyx_L0;
13776  __pyx_L1_error:;
13777  __Pyx_XDECREF(__pyx_t_10);
13778  __Pyx_XDECREF(__pyx_t_11);
13779  __Pyx_XDECREF(__pyx_t_19);
13780  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
13781  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
13782  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
13783  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mt.rcbuffer->pybuffer);
13784  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer);
13785  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weak_residual.rcbuffer->pybuffer);
13786  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
13787  __Pyx_AddTraceback("subsurfaceTransportFunctions.updateMass_weakAvg", __pyx_clineno, __pyx_lineno, __pyx_filename);
13788  __pyx_r = NULL;
13789  goto __pyx_L2;
13790  __pyx_L0:;
13791  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
13792  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mt.rcbuffer->pybuffer);
13793  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer);
13794  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weak_residual.rcbuffer->pybuffer);
13795  __pyx_L2:;
13796  __Pyx_XDECREF(__pyx_v_mt_avg);
13797  __Pyx_XDECREF(__pyx_v_vol);
13798  __Pyx_XGIVEREF(__pyx_r);
13799  __Pyx_RefNannyFinishContext();
13800  return __pyx_r;
13801 }
13802 
13803 /* "subsurfaceTransportFunctions.pyx":692
13804  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
13805  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
13806  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt, # <<<<<<<<<<<<<<
13807  * numpy.ndarray[DTYPE_t,ndim=3] w,
13808  * numpy.ndarray[DTYPE_t,ndim=3] v,
13809  */
13810 
13811 /* Python wrapper */
13812 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
13813 static char __pyx_doc_28subsurfaceTransportFunctions_38updateMassJacobian_weakAvg[] = "\n approximate element mass Jacobian term as (\\pd{\010ar{c}_e}{u_j},w_{h,i})_e\n ";
13814 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg = {"updateMassJacobian_weakAvg", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_38updateMassJacobian_weakAvg};
13815 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
13816  PyArrayObject *__pyx_v_dmt = 0;
13817  PyArrayObject *__pyx_v_w = 0;
13818  PyArrayObject *__pyx_v_v = 0;
13819  PyArrayObject *__pyx_v_dV = 0;
13820  PyArrayObject *__pyx_v_jacobian_weak_residual = 0;
13821  int __pyx_lineno = 0;
13822  const char *__pyx_filename = NULL;
13823  int __pyx_clineno = 0;
13824  PyObject *__pyx_r = 0;
13825  __Pyx_RefNannyDeclarations
13826  __Pyx_RefNannySetupContext("updateMassJacobian_weakAvg (wrapper)", 0);
13827  {
13828  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dmt,&__pyx_n_s_w,&__pyx_n_s_v,&__pyx_n_s_dV,&__pyx_n_s_jacobian_weak_residual,0};
13829  PyObject* values[5] = {0,0,0,0,0};
13830  if (unlikely(__pyx_kwds)) {
13831  Py_ssize_t kw_args;
13832  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
13833  switch (pos_args) {
13834  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
13835  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
13836  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
13837  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
13838  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13839  case 0: break;
13840  default: goto __pyx_L5_argtuple_error;
13841  }
13842  kw_args = PyDict_Size(__pyx_kwds);
13843  switch (pos_args) {
13844  case 0:
13845  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dmt)) != 0)) kw_args--;
13846  else goto __pyx_L5_argtuple_error;
13847  case 1:
13848  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
13849  else {
13850  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
13851  }
13852  case 2:
13853  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
13854  else {
13855  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
13856  }
13857  case 3:
13858  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dV)) != 0)) kw_args--;
13859  else {
13860  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
13861  }
13862  case 4:
13863  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_jacobian_weak_residual)) != 0)) kw_args--;
13864  else {
13865  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
13866  }
13867  }
13868  if (unlikely(kw_args > 0)) {
13869  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "updateMassJacobian_weakAvg") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
13870  }
13871  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
13872  goto __pyx_L5_argtuple_error;
13873  } else {
13874  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13875  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
13876  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
13877  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
13878  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
13879  }
13880  __pyx_v_dmt = ((PyArrayObject *)values[0]);
13881  __pyx_v_w = ((PyArrayObject *)values[1]);
13882  __pyx_v_v = ((PyArrayObject *)values[2]);
13883  __pyx_v_dV = ((PyArrayObject *)values[3]);
13884  __pyx_v_jacobian_weak_residual = ((PyArrayObject *)values[4]);
13885  }
13886  goto __pyx_L4_argument_unpacking_done;
13887  __pyx_L5_argtuple_error:;
13888  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
13889  __pyx_L3_error:;
13890  __Pyx_AddTraceback("subsurfaceTransportFunctions.updateMassJacobian_weakAvg", __pyx_clineno, __pyx_lineno, __pyx_filename);
13891  __Pyx_RefNannyFinishContext();
13892  return NULL;
13893  __pyx_L4_argument_unpacking_done:;
13894  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dmt), __pyx_ptype_5numpy_ndarray, 1, "dmt", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13895  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_5numpy_ndarray, 1, "w", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13896  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13897  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dV), __pyx_ptype_5numpy_ndarray, 1, "dV", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13898  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_jacobian_weak_residual), __pyx_ptype_5numpy_ndarray, 1, "jacobian_weak_residual", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13899  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_38updateMassJacobian_weakAvg(__pyx_self, __pyx_v_dmt, __pyx_v_w, __pyx_v_v, __pyx_v_dV, __pyx_v_jacobian_weak_residual);
13900 
13901  /* function exit code */
13902  goto __pyx_L0;
13903  __pyx_L1_error:;
13904  __pyx_r = NULL;
13905  __pyx_L0:;
13906  __Pyx_RefNannyFinishContext();
13907  return __pyx_r;
13908 }
13909 
13910 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_38updateMassJacobian_weakAvg(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_dmt, PyArrayObject *__pyx_v_w, PyArrayObject *__pyx_v_v, PyArrayObject *__pyx_v_dV, PyArrayObject *__pyx_v_jacobian_weak_residual) {
13911  int __pyx_v_eN;
13912  int __pyx_v_i;
13913  int __pyx_v_j;
13914  int __pyx_v_k;
13915  double __pyx_v_dmtj_avg;
13916  double __pyx_v_vol;
13917  __Pyx_LocalBuf_ND __pyx_pybuffernd_dV;
13918  __Pyx_Buffer __pyx_pybuffer_dV;
13919  __Pyx_LocalBuf_ND __pyx_pybuffernd_dmt;
13920  __Pyx_Buffer __pyx_pybuffer_dmt;
13921  __Pyx_LocalBuf_ND __pyx_pybuffernd_jacobian_weak_residual;
13922  __Pyx_Buffer __pyx_pybuffer_jacobian_weak_residual;
13923  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
13924  __Pyx_Buffer __pyx_pybuffer_v;
13925  __Pyx_LocalBuf_ND __pyx_pybuffernd_w;
13926  __Pyx_Buffer __pyx_pybuffer_w;
13927  PyObject *__pyx_r = NULL;
13928  __Pyx_RefNannyDeclarations
13929  npy_intp __pyx_t_1;
13930  int __pyx_t_2;
13931  npy_intp __pyx_t_3;
13932  int __pyx_t_4;
13933  Py_ssize_t __pyx_t_5;
13934  Py_ssize_t __pyx_t_6;
13935  int __pyx_t_7;
13936  npy_intp __pyx_t_8;
13937  npy_intp __pyx_t_9;
13938  int __pyx_t_10;
13939  Py_ssize_t __pyx_t_11;
13940  Py_ssize_t __pyx_t_12;
13941  int __pyx_t_13;
13942  Py_ssize_t __pyx_t_14;
13943  Py_ssize_t __pyx_t_15;
13944  Py_ssize_t __pyx_t_16;
13945  Py_ssize_t __pyx_t_17;
13946  Py_ssize_t __pyx_t_18;
13947  Py_ssize_t __pyx_t_19;
13948  Py_ssize_t __pyx_t_20;
13949  Py_ssize_t __pyx_t_21;
13950  Py_ssize_t __pyx_t_22;
13951  Py_ssize_t __pyx_t_23;
13952  Py_ssize_t __pyx_t_24;
13953  Py_ssize_t __pyx_t_25;
13954  Py_ssize_t __pyx_t_26;
13955  int __pyx_lineno = 0;
13956  const char *__pyx_filename = NULL;
13957  int __pyx_clineno = 0;
13958  __Pyx_RefNannySetupContext("updateMassJacobian_weakAvg", 0);
13959  __pyx_pybuffer_dmt.pybuffer.buf = NULL;
13960  __pyx_pybuffer_dmt.refcount = 0;
13961  __pyx_pybuffernd_dmt.data = NULL;
13962  __pyx_pybuffernd_dmt.rcbuffer = &__pyx_pybuffer_dmt;
13963  __pyx_pybuffer_w.pybuffer.buf = NULL;
13964  __pyx_pybuffer_w.refcount = 0;
13965  __pyx_pybuffernd_w.data = NULL;
13966  __pyx_pybuffernd_w.rcbuffer = &__pyx_pybuffer_w;
13967  __pyx_pybuffer_v.pybuffer.buf = NULL;
13968  __pyx_pybuffer_v.refcount = 0;
13969  __pyx_pybuffernd_v.data = NULL;
13970  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
13971  __pyx_pybuffer_dV.pybuffer.buf = NULL;
13972  __pyx_pybuffer_dV.refcount = 0;
13973  __pyx_pybuffernd_dV.data = NULL;
13974  __pyx_pybuffernd_dV.rcbuffer = &__pyx_pybuffer_dV;
13975  __pyx_pybuffer_jacobian_weak_residual.pybuffer.buf = NULL;
13976  __pyx_pybuffer_jacobian_weak_residual.refcount = 0;
13977  __pyx_pybuffernd_jacobian_weak_residual.data = NULL;
13978  __pyx_pybuffernd_jacobian_weak_residual.rcbuffer = &__pyx_pybuffer_jacobian_weak_residual;
13979  {
13980  __Pyx_BufFmt_StackElem __pyx_stack[1];
13981  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dmt.rcbuffer->pybuffer, (PyObject*)__pyx_v_dmt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13982  }
13983  __pyx_pybuffernd_dmt.diminfo[0].strides = __pyx_pybuffernd_dmt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dmt.diminfo[0].shape = __pyx_pybuffernd_dmt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dmt.diminfo[1].strides = __pyx_pybuffernd_dmt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dmt.diminfo[1].shape = __pyx_pybuffernd_dmt.rcbuffer->pybuffer.shape[1];
13984  {
13985  __Pyx_BufFmt_StackElem __pyx_stack[1];
13986  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_w, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13987  }
13988  __pyx_pybuffernd_w.diminfo[0].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_w.diminfo[0].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_w.diminfo[1].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_w.diminfo[1].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_w.diminfo[2].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_w.diminfo[2].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[2];
13989  {
13990  __Pyx_BufFmt_StackElem __pyx_stack[1];
13991  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13992  }
13993  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2];
13994  {
13995  __Pyx_BufFmt_StackElem __pyx_stack[1];
13996  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_v_dV, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13997  }
13998  __pyx_pybuffernd_dV.diminfo[0].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dV.diminfo[0].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dV.diminfo[1].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dV.diminfo[1].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[1];
13999  {
14000  __Pyx_BufFmt_StackElem __pyx_stack[1];
14001  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer, (PyObject*)__pyx_v_jacobian_weak_residual, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14002  }
14003  __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].strides = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].shape = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].strides = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].shape = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].strides = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].shape = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.shape[2];
14004 
14005  /* "subsurfaceTransportFunctions.pyx":702
14006  * cdef int eN,i,j,k
14007  * cdef double dmtj_avg,vol
14008  * for eN in range(dmt.shape[0]): # <<<<<<<<<<<<<<
14009  * vol = 0.0 #should I save a loop?
14010  * for k in range(dmt.shape[1]):
14011  */
14012  __pyx_t_1 = (__pyx_v_dmt->dimensions[0]);
14013  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
14014  __pyx_v_eN = __pyx_t_2;
14015 
14016  /* "subsurfaceTransportFunctions.pyx":703
14017  * cdef double dmtj_avg,vol
14018  * for eN in range(dmt.shape[0]):
14019  * vol = 0.0 #should I save a loop? # <<<<<<<<<<<<<<
14020  * for k in range(dmt.shape[1]):
14021  * vol += dV[eN,k]
14022  */
14023  __pyx_v_vol = 0.0;
14024 
14025  /* "subsurfaceTransportFunctions.pyx":704
14026  * for eN in range(dmt.shape[0]):
14027  * vol = 0.0 #should I save a loop?
14028  * for k in range(dmt.shape[1]): # <<<<<<<<<<<<<<
14029  * vol += dV[eN,k]
14030  * for i in range(w.shape[2]):
14031  */
14032  __pyx_t_3 = (__pyx_v_dmt->dimensions[1]);
14033  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
14034  __pyx_v_k = __pyx_t_4;
14035 
14036  /* "subsurfaceTransportFunctions.pyx":705
14037  * vol = 0.0 #should I save a loop?
14038  * for k in range(dmt.shape[1]):
14039  * vol += dV[eN,k] # <<<<<<<<<<<<<<
14040  * for i in range(w.shape[2]):
14041  * for j in range(v.shape[2]):
14042  */
14043  __pyx_t_5 = __pyx_v_eN;
14044  __pyx_t_6 = __pyx_v_k;
14045  __pyx_t_7 = -1;
14046  if (__pyx_t_5 < 0) {
14047  __pyx_t_5 += __pyx_pybuffernd_dV.diminfo[0].shape;
14048  if (unlikely(__pyx_t_5 < 0)) __pyx_t_7 = 0;
14049  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_7 = 0;
14050  if (__pyx_t_6 < 0) {
14051  __pyx_t_6 += __pyx_pybuffernd_dV.diminfo[1].shape;
14052  if (unlikely(__pyx_t_6 < 0)) __pyx_t_7 = 1;
14053  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_7 = 1;
14054  if (unlikely(__pyx_t_7 != -1)) {
14055  __Pyx_RaiseBufferIndexError(__pyx_t_7);
14056  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14057  }
14058  __pyx_v_vol = (__pyx_v_vol + (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_dV.diminfo[1].strides)));
14059  }
14060 
14061  /* "subsurfaceTransportFunctions.pyx":706
14062  * for k in range(dmt.shape[1]):
14063  * vol += dV[eN,k]
14064  * for i in range(w.shape[2]): # <<<<<<<<<<<<<<
14065  * for j in range(v.shape[2]):
14066  * dmtj_avg = 0.0
14067  */
14068  __pyx_t_3 = (__pyx_v_w->dimensions[2]);
14069  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
14070  __pyx_v_i = __pyx_t_4;
14071 
14072  /* "subsurfaceTransportFunctions.pyx":707
14073  * vol += dV[eN,k]
14074  * for i in range(w.shape[2]):
14075  * for j in range(v.shape[2]): # <<<<<<<<<<<<<<
14076  * dmtj_avg = 0.0
14077  * for k in range(dmt.shape[1]):
14078  */
14079  __pyx_t_8 = (__pyx_v_v->dimensions[2]);
14080  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_8; __pyx_t_7+=1) {
14081  __pyx_v_j = __pyx_t_7;
14082 
14083  /* "subsurfaceTransportFunctions.pyx":708
14084  * for i in range(w.shape[2]):
14085  * for j in range(v.shape[2]):
14086  * dmtj_avg = 0.0 # <<<<<<<<<<<<<<
14087  * for k in range(dmt.shape[1]):
14088  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j]
14089  */
14090  __pyx_v_dmtj_avg = 0.0;
14091 
14092  /* "subsurfaceTransportFunctions.pyx":709
14093  * for j in range(v.shape[2]):
14094  * dmtj_avg = 0.0
14095  * for k in range(dmt.shape[1]): # <<<<<<<<<<<<<<
14096  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j]
14097  * dmtj_avg /= vol
14098  */
14099  __pyx_t_9 = (__pyx_v_dmt->dimensions[1]);
14100  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
14101  __pyx_v_k = __pyx_t_10;
14102 
14103  /* "subsurfaceTransportFunctions.pyx":710
14104  * dmtj_avg = 0.0
14105  * for k in range(dmt.shape[1]):
14106  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j] # <<<<<<<<<<<<<<
14107  * dmtj_avg /= vol
14108  * jacobian_weak_residual[eN,i,j] += dmtj_avg*w[eN,k,i]*dV[eN,k]
14109  */
14110  __pyx_t_11 = __pyx_v_eN;
14111  __pyx_t_12 = __pyx_v_k;
14112  __pyx_t_13 = -1;
14113  if (__pyx_t_11 < 0) {
14114  __pyx_t_11 += __pyx_pybuffernd_dV.diminfo[0].shape;
14115  if (unlikely(__pyx_t_11 < 0)) __pyx_t_13 = 0;
14116  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_13 = 0;
14117  if (__pyx_t_12 < 0) {
14118  __pyx_t_12 += __pyx_pybuffernd_dV.diminfo[1].shape;
14119  if (unlikely(__pyx_t_12 < 0)) __pyx_t_13 = 1;
14120  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_13 = 1;
14121  if (unlikely(__pyx_t_13 != -1)) {
14122  __Pyx_RaiseBufferIndexError(__pyx_t_13);
14123  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14124  }
14125  __pyx_t_14 = __pyx_v_eN;
14126  __pyx_t_15 = __pyx_v_k;
14127  __pyx_t_13 = -1;
14128  if (__pyx_t_14 < 0) {
14129  __pyx_t_14 += __pyx_pybuffernd_dmt.diminfo[0].shape;
14130  if (unlikely(__pyx_t_14 < 0)) __pyx_t_13 = 0;
14131  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_dmt.diminfo[0].shape)) __pyx_t_13 = 0;
14132  if (__pyx_t_15 < 0) {
14133  __pyx_t_15 += __pyx_pybuffernd_dmt.diminfo[1].shape;
14134  if (unlikely(__pyx_t_15 < 0)) __pyx_t_13 = 1;
14135  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_dmt.diminfo[1].shape)) __pyx_t_13 = 1;
14136  if (unlikely(__pyx_t_13 != -1)) {
14137  __Pyx_RaiseBufferIndexError(__pyx_t_13);
14138  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14139  }
14140  __pyx_t_16 = __pyx_v_eN;
14141  __pyx_t_17 = __pyx_v_k;
14142  __pyx_t_18 = __pyx_v_j;
14143  __pyx_t_13 = -1;
14144  if (__pyx_t_16 < 0) {
14145  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[0].shape;
14146  if (unlikely(__pyx_t_16 < 0)) __pyx_t_13 = 0;
14147  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_13 = 0;
14148  if (__pyx_t_17 < 0) {
14149  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[1].shape;
14150  if (unlikely(__pyx_t_17 < 0)) __pyx_t_13 = 1;
14151  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_13 = 1;
14152  if (__pyx_t_18 < 0) {
14153  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[2].shape;
14154  if (unlikely(__pyx_t_18 < 0)) __pyx_t_13 = 2;
14155  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_13 = 2;
14156  if (unlikely(__pyx_t_13 != -1)) {
14157  __Pyx_RaiseBufferIndexError(__pyx_t_13);
14158  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14159  }
14160  __pyx_v_dmtj_avg = (__pyx_v_dmtj_avg + (((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_dV.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dmt.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_dmt.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_dmt.diminfo[1].strides))) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[2].strides))));
14161  }
14162 
14163  /* "subsurfaceTransportFunctions.pyx":711
14164  * for k in range(dmt.shape[1]):
14165  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j]
14166  * dmtj_avg /= vol # <<<<<<<<<<<<<<
14167  * jacobian_weak_residual[eN,i,j] += dmtj_avg*w[eN,k,i]*dV[eN,k]
14168  *
14169  */
14170  if (unlikely(__pyx_v_vol == 0)) {
14171  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
14172  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14173  }
14174  __pyx_v_dmtj_avg = (__pyx_v_dmtj_avg / __pyx_v_vol);
14175 
14176  /* "subsurfaceTransportFunctions.pyx":712
14177  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j]
14178  * dmtj_avg /= vol
14179  * jacobian_weak_residual[eN,i,j] += dmtj_avg*w[eN,k,i]*dV[eN,k] # <<<<<<<<<<<<<<
14180  *
14181  * ########################################################################
14182  */
14183  __pyx_t_19 = __pyx_v_eN;
14184  __pyx_t_20 = __pyx_v_k;
14185  __pyx_t_21 = __pyx_v_i;
14186  __pyx_t_10 = -1;
14187  if (__pyx_t_19 < 0) {
14188  __pyx_t_19 += __pyx_pybuffernd_w.diminfo[0].shape;
14189  if (unlikely(__pyx_t_19 < 0)) __pyx_t_10 = 0;
14190  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_w.diminfo[0].shape)) __pyx_t_10 = 0;
14191  if (__pyx_t_20 < 0) {
14192  __pyx_t_20 += __pyx_pybuffernd_w.diminfo[1].shape;
14193  if (unlikely(__pyx_t_20 < 0)) __pyx_t_10 = 1;
14194  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_w.diminfo[1].shape)) __pyx_t_10 = 1;
14195  if (__pyx_t_21 < 0) {
14196  __pyx_t_21 += __pyx_pybuffernd_w.diminfo[2].shape;
14197  if (unlikely(__pyx_t_21 < 0)) __pyx_t_10 = 2;
14198  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_w.diminfo[2].shape)) __pyx_t_10 = 2;
14199  if (unlikely(__pyx_t_10 != -1)) {
14200  __Pyx_RaiseBufferIndexError(__pyx_t_10);
14201  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14202  }
14203  __pyx_t_22 = __pyx_v_eN;
14204  __pyx_t_23 = __pyx_v_k;
14205  __pyx_t_10 = -1;
14206  if (__pyx_t_22 < 0) {
14207  __pyx_t_22 += __pyx_pybuffernd_dV.diminfo[0].shape;
14208  if (unlikely(__pyx_t_22 < 0)) __pyx_t_10 = 0;
14209  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_10 = 0;
14210  if (__pyx_t_23 < 0) {
14211  __pyx_t_23 += __pyx_pybuffernd_dV.diminfo[1].shape;
14212  if (unlikely(__pyx_t_23 < 0)) __pyx_t_10 = 1;
14213  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_10 = 1;
14214  if (unlikely(__pyx_t_10 != -1)) {
14215  __Pyx_RaiseBufferIndexError(__pyx_t_10);
14216  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14217  }
14218  __pyx_t_24 = __pyx_v_eN;
14219  __pyx_t_25 = __pyx_v_i;
14220  __pyx_t_26 = __pyx_v_j;
14221  __pyx_t_10 = -1;
14222  if (__pyx_t_24 < 0) {
14223  __pyx_t_24 += __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].shape;
14224  if (unlikely(__pyx_t_24 < 0)) __pyx_t_10 = 0;
14225  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].shape)) __pyx_t_10 = 0;
14226  if (__pyx_t_25 < 0) {
14227  __pyx_t_25 += __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].shape;
14228  if (unlikely(__pyx_t_25 < 0)) __pyx_t_10 = 1;
14229  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].shape)) __pyx_t_10 = 1;
14230  if (__pyx_t_26 < 0) {
14231  __pyx_t_26 += __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].shape;
14232  if (unlikely(__pyx_t_26 < 0)) __pyx_t_10 = 2;
14233  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].shape)) __pyx_t_10 = 2;
14234  if (unlikely(__pyx_t_10 != -1)) {
14235  __Pyx_RaiseBufferIndexError(__pyx_t_10);
14236  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14237  }
14238  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].strides, __pyx_t_26, __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].strides) += ((__pyx_v_dmtj_avg * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_w.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_w.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_w.diminfo[1].strides, __pyx_t_21, __pyx_pybuffernd_w.diminfo[2].strides))) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_dV.diminfo[1].strides)));
14239  }
14240  }
14241  }
14242 
14243  /* "subsurfaceTransportFunctions.pyx":692
14244  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
14245  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
14246  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt, # <<<<<<<<<<<<<<
14247  * numpy.ndarray[DTYPE_t,ndim=3] w,
14248  * numpy.ndarray[DTYPE_t,ndim=3] v,
14249  */
14250 
14251  /* function exit code */
14252  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14253  goto __pyx_L0;
14254  __pyx_L1_error:;
14255  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
14256  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
14257  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
14258  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dmt.rcbuffer->pybuffer);
14259  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer);
14260  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
14261  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer);
14262  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
14263  __Pyx_AddTraceback("subsurfaceTransportFunctions.updateMassJacobian_weakAvg", __pyx_clineno, __pyx_lineno, __pyx_filename);
14264  __pyx_r = NULL;
14265  goto __pyx_L2;
14266  __pyx_L0:;
14267  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
14268  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dmt.rcbuffer->pybuffer);
14269  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer);
14270  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
14271  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer);
14272  __pyx_L2:;
14273  __Pyx_XGIVEREF(__pyx_r);
14274  __Pyx_RefNannyFinishContext();
14275  return __pyx_r;
14276 }
14277 
14278 /* "subsurfaceTransportFunctions.pyx":717
14279  * #ELLAM
14280  * ########################################################################
14281  * def calculateNormalFlux(numpy.ndarray[DTYPE_t,ndim=4] v, # <<<<<<<<<<<<<<
14282  * numpy.ndarray[DTYPE_t,ndim=4] n,
14283  * numpy.ndarray[DTYPE_t,ndim=3] dS,
14284  */
14285 
14286 /* Python wrapper */
14287 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_41calculateNormalFlux(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
14288 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_41calculateNormalFlux = {"calculateNormalFlux", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_41calculateNormalFlux, METH_VARARGS|METH_KEYWORDS, 0};
14289 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_41calculateNormalFlux(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
14290  PyArrayObject *__pyx_v_v = 0;
14291  PyArrayObject *__pyx_v_n = 0;
14292  PyArrayObject *__pyx_v_dS = 0;
14293  PyArrayObject *__pyx_v_flux = 0;
14294  int __pyx_lineno = 0;
14295  const char *__pyx_filename = NULL;
14296  int __pyx_clineno = 0;
14297  PyObject *__pyx_r = 0;
14298  __Pyx_RefNannyDeclarations
14299  __Pyx_RefNannySetupContext("calculateNormalFlux (wrapper)", 0);
14300  {
14301  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,&__pyx_n_s_n,&__pyx_n_s_dS,&__pyx_n_s_flux,0};
14302  PyObject* values[4] = {0,0,0,0};
14303  if (unlikely(__pyx_kwds)) {
14304  Py_ssize_t kw_args;
14305  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
14306  switch (pos_args) {
14307  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
14308  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
14309  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
14310  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
14311  case 0: break;
14312  default: goto __pyx_L5_argtuple_error;
14313  }
14314  kw_args = PyDict_Size(__pyx_kwds);
14315  switch (pos_args) {
14316  case 0:
14317  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
14318  else goto __pyx_L5_argtuple_error;
14319  case 1:
14320  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
14321  else {
14322  __Pyx_RaiseArgtupleInvalid("calculateNormalFlux", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
14323  }
14324  case 2:
14325  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dS)) != 0)) kw_args--;
14326  else {
14327  __Pyx_RaiseArgtupleInvalid("calculateNormalFlux", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
14328  }
14329  case 3:
14330  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_flux)) != 0)) kw_args--;
14331  else {
14332  __Pyx_RaiseArgtupleInvalid("calculateNormalFlux", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
14333  }
14334  }
14335  if (unlikely(kw_args > 0)) {
14336  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calculateNormalFlux") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
14337  }
14338  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
14339  goto __pyx_L5_argtuple_error;
14340  } else {
14341  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
14342  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
14343  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
14344  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
14345  }
14346  __pyx_v_v = ((PyArrayObject *)values[0]);
14347  __pyx_v_n = ((PyArrayObject *)values[1]);
14348  __pyx_v_dS = ((PyArrayObject *)values[2]);
14349  __pyx_v_flux = ((PyArrayObject *)values[3]);
14350  }
14351  goto __pyx_L4_argument_unpacking_done;
14352  __pyx_L5_argtuple_error:;
14353  __Pyx_RaiseArgtupleInvalid("calculateNormalFlux", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
14354  __pyx_L3_error:;
14355  __Pyx_AddTraceback("subsurfaceTransportFunctions.calculateNormalFlux", __pyx_clineno, __pyx_lineno, __pyx_filename);
14356  __Pyx_RefNannyFinishContext();
14357  return NULL;
14358  __pyx_L4_argument_unpacking_done:;
14359  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14360  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_n), __pyx_ptype_5numpy_ndarray, 1, "n", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14361  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dS), __pyx_ptype_5numpy_ndarray, 1, "dS", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14362  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_flux), __pyx_ptype_5numpy_ndarray, 1, "flux", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14363  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_40calculateNormalFlux(__pyx_self, __pyx_v_v, __pyx_v_n, __pyx_v_dS, __pyx_v_flux);
14364 
14365  /* function exit code */
14366  goto __pyx_L0;
14367  __pyx_L1_error:;
14368  __pyx_r = NULL;
14369  __pyx_L0:;
14370  __Pyx_RefNannyFinishContext();
14371  return __pyx_r;
14372 }
14373 
14374 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_40calculateNormalFlux(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_v, PyArrayObject *__pyx_v_n, PyArrayObject *__pyx_v_dS, PyArrayObject *__pyx_v_flux) {
14375  int __pyx_v_eN;
14376  int __pyx_v_ebN;
14377  int __pyx_v_kb;
14378  double __pyx_v_integral;
14379  npy_intp __pyx_v_I;
14380  __Pyx_LocalBuf_ND __pyx_pybuffernd_dS;
14381  __Pyx_Buffer __pyx_pybuffer_dS;
14382  __Pyx_LocalBuf_ND __pyx_pybuffernd_flux;
14383  __Pyx_Buffer __pyx_pybuffer_flux;
14384  __Pyx_LocalBuf_ND __pyx_pybuffernd_n;
14385  __Pyx_Buffer __pyx_pybuffer_n;
14386  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
14387  __Pyx_Buffer __pyx_pybuffer_v;
14388  PyObject *__pyx_r = NULL;
14389  __Pyx_RefNannyDeclarations
14390  npy_intp __pyx_t_1;
14391  int __pyx_t_2;
14392  npy_intp __pyx_t_3;
14393  int __pyx_t_4;
14394  npy_intp __pyx_t_5;
14395  int __pyx_t_6;
14396  npy_intp __pyx_t_7;
14397  npy_intp __pyx_t_8;
14398  Py_ssize_t __pyx_t_9;
14399  Py_ssize_t __pyx_t_10;
14400  Py_ssize_t __pyx_t_11;
14401  Py_ssize_t __pyx_t_12;
14402  int __pyx_t_13;
14403  Py_ssize_t __pyx_t_14;
14404  Py_ssize_t __pyx_t_15;
14405  Py_ssize_t __pyx_t_16;
14406  Py_ssize_t __pyx_t_17;
14407  Py_ssize_t __pyx_t_18;
14408  Py_ssize_t __pyx_t_19;
14409  Py_ssize_t __pyx_t_20;
14410  Py_ssize_t __pyx_t_21;
14411  Py_ssize_t __pyx_t_22;
14412  int __pyx_lineno = 0;
14413  const char *__pyx_filename = NULL;
14414  int __pyx_clineno = 0;
14415  __Pyx_RefNannySetupContext("calculateNormalFlux", 0);
14416  __pyx_pybuffer_v.pybuffer.buf = NULL;
14417  __pyx_pybuffer_v.refcount = 0;
14418  __pyx_pybuffernd_v.data = NULL;
14419  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
14420  __pyx_pybuffer_n.pybuffer.buf = NULL;
14421  __pyx_pybuffer_n.refcount = 0;
14422  __pyx_pybuffernd_n.data = NULL;
14423  __pyx_pybuffernd_n.rcbuffer = &__pyx_pybuffer_n;
14424  __pyx_pybuffer_dS.pybuffer.buf = NULL;
14425  __pyx_pybuffer_dS.refcount = 0;
14426  __pyx_pybuffernd_dS.data = NULL;
14427  __pyx_pybuffernd_dS.rcbuffer = &__pyx_pybuffer_dS;
14428  __pyx_pybuffer_flux.pybuffer.buf = NULL;
14429  __pyx_pybuffer_flux.refcount = 0;
14430  __pyx_pybuffernd_flux.data = NULL;
14431  __pyx_pybuffernd_flux.rcbuffer = &__pyx_pybuffer_flux;
14432  {
14433  __Pyx_BufFmt_StackElem __pyx_stack[1];
14434  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14435  }
14436  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_v.diminfo[3].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_v.diminfo[3].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[3];
14437  {
14438  __Pyx_BufFmt_StackElem __pyx_stack[1];
14439  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_n.rcbuffer->pybuffer, (PyObject*)__pyx_v_n, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14440  }
14441  __pyx_pybuffernd_n.diminfo[0].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_n.diminfo[0].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_n.diminfo[1].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_n.diminfo[1].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_n.diminfo[2].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_n.diminfo[2].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_n.diminfo[3].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_n.diminfo[3].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[3];
14442  {
14443  __Pyx_BufFmt_StackElem __pyx_stack[1];
14444  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_v_dS, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14445  }
14446  __pyx_pybuffernd_dS.diminfo[0].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dS.diminfo[0].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dS.diminfo[1].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dS.diminfo[1].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_dS.diminfo[2].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_dS.diminfo[2].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[2];
14447  {
14448  __Pyx_BufFmt_StackElem __pyx_stack[1];
14449  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_flux.rcbuffer->pybuffer, (PyObject*)__pyx_v_flux, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14450  }
14451  __pyx_pybuffernd_flux.diminfo[0].strides = __pyx_pybuffernd_flux.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_flux.diminfo[0].shape = __pyx_pybuffernd_flux.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_flux.diminfo[1].strides = __pyx_pybuffernd_flux.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_flux.diminfo[1].shape = __pyx_pybuffernd_flux.rcbuffer->pybuffer.shape[1];
14452 
14453  /* "subsurfaceTransportFunctions.pyx":724
14454  * cdef int eN,ebN,kb
14455  * cdef double integral
14456  * for eN in range(n.shape[0]): # <<<<<<<<<<<<<<
14457  * for ebN in range(n.shape[1]):
14458  * integral = 0.0
14459  */
14460  __pyx_t_1 = (__pyx_v_n->dimensions[0]);
14461  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
14462  __pyx_v_eN = __pyx_t_2;
14463 
14464  /* "subsurfaceTransportFunctions.pyx":725
14465  * cdef double integral
14466  * for eN in range(n.shape[0]):
14467  * for ebN in range(n.shape[1]): # <<<<<<<<<<<<<<
14468  * integral = 0.0
14469  * for kb in range(n.shape[2]):
14470  */
14471  __pyx_t_3 = (__pyx_v_n->dimensions[1]);
14472  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
14473  __pyx_v_ebN = __pyx_t_4;
14474 
14475  /* "subsurfaceTransportFunctions.pyx":726
14476  * for eN in range(n.shape[0]):
14477  * for ebN in range(n.shape[1]):
14478  * integral = 0.0 # <<<<<<<<<<<<<<
14479  * for kb in range(n.shape[2]):
14480  * for I in range(n.shape[3]):
14481  */
14482  __pyx_v_integral = 0.0;
14483 
14484  /* "subsurfaceTransportFunctions.pyx":727
14485  * for ebN in range(n.shape[1]):
14486  * integral = 0.0
14487  * for kb in range(n.shape[2]): # <<<<<<<<<<<<<<
14488  * for I in range(n.shape[3]):
14489  * integral += v[eN,ebN,kb,I]*n[eN,ebN,kb,I]*dS[eN,ebN,kb]
14490  */
14491  __pyx_t_5 = (__pyx_v_n->dimensions[2]);
14492  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
14493  __pyx_v_kb = __pyx_t_6;
14494 
14495  /* "subsurfaceTransportFunctions.pyx":728
14496  * integral = 0.0
14497  * for kb in range(n.shape[2]):
14498  * for I in range(n.shape[3]): # <<<<<<<<<<<<<<
14499  * integral += v[eN,ebN,kb,I]*n[eN,ebN,kb,I]*dS[eN,ebN,kb]
14500  * flux[eN,ebN] = integral
14501  */
14502  __pyx_t_7 = (__pyx_v_n->dimensions[3]);
14503  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
14504  __pyx_v_I = __pyx_t_8;
14505 
14506  /* "subsurfaceTransportFunctions.pyx":729
14507  * for kb in range(n.shape[2]):
14508  * for I in range(n.shape[3]):
14509  * integral += v[eN,ebN,kb,I]*n[eN,ebN,kb,I]*dS[eN,ebN,kb] # <<<<<<<<<<<<<<
14510  * flux[eN,ebN] = integral
14511  *
14512  */
14513  __pyx_t_9 = __pyx_v_eN;
14514  __pyx_t_10 = __pyx_v_ebN;
14515  __pyx_t_11 = __pyx_v_kb;
14516  __pyx_t_12 = __pyx_v_I;
14517  __pyx_t_13 = -1;
14518  if (__pyx_t_9 < 0) {
14519  __pyx_t_9 += __pyx_pybuffernd_v.diminfo[0].shape;
14520  if (unlikely(__pyx_t_9 < 0)) __pyx_t_13 = 0;
14521  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_13 = 0;
14522  if (__pyx_t_10 < 0) {
14523  __pyx_t_10 += __pyx_pybuffernd_v.diminfo[1].shape;
14524  if (unlikely(__pyx_t_10 < 0)) __pyx_t_13 = 1;
14525  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_13 = 1;
14526  if (__pyx_t_11 < 0) {
14527  __pyx_t_11 += __pyx_pybuffernd_v.diminfo[2].shape;
14528  if (unlikely(__pyx_t_11 < 0)) __pyx_t_13 = 2;
14529  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_13 = 2;
14530  if (__pyx_t_12 < 0) {
14531  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[3].shape;
14532  if (unlikely(__pyx_t_12 < 0)) __pyx_t_13 = 3;
14533  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_13 = 3;
14534  if (unlikely(__pyx_t_13 != -1)) {
14535  __Pyx_RaiseBufferIndexError(__pyx_t_13);
14536  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14537  }
14538  __pyx_t_14 = __pyx_v_eN;
14539  __pyx_t_15 = __pyx_v_ebN;
14540  __pyx_t_16 = __pyx_v_kb;
14541  __pyx_t_17 = __pyx_v_I;
14542  __pyx_t_13 = -1;
14543  if (__pyx_t_14 < 0) {
14544  __pyx_t_14 += __pyx_pybuffernd_n.diminfo[0].shape;
14545  if (unlikely(__pyx_t_14 < 0)) __pyx_t_13 = 0;
14546  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_13 = 0;
14547  if (__pyx_t_15 < 0) {
14548  __pyx_t_15 += __pyx_pybuffernd_n.diminfo[1].shape;
14549  if (unlikely(__pyx_t_15 < 0)) __pyx_t_13 = 1;
14550  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_n.diminfo[1].shape)) __pyx_t_13 = 1;
14551  if (__pyx_t_16 < 0) {
14552  __pyx_t_16 += __pyx_pybuffernd_n.diminfo[2].shape;
14553  if (unlikely(__pyx_t_16 < 0)) __pyx_t_13 = 2;
14554  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_n.diminfo[2].shape)) __pyx_t_13 = 2;
14555  if (__pyx_t_17 < 0) {
14556  __pyx_t_17 += __pyx_pybuffernd_n.diminfo[3].shape;
14557  if (unlikely(__pyx_t_17 < 0)) __pyx_t_13 = 3;
14558  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_n.diminfo[3].shape)) __pyx_t_13 = 3;
14559  if (unlikely(__pyx_t_13 != -1)) {
14560  __Pyx_RaiseBufferIndexError(__pyx_t_13);
14561  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14562  }
14563  __pyx_t_18 = __pyx_v_eN;
14564  __pyx_t_19 = __pyx_v_ebN;
14565  __pyx_t_20 = __pyx_v_kb;
14566  __pyx_t_13 = -1;
14567  if (__pyx_t_18 < 0) {
14568  __pyx_t_18 += __pyx_pybuffernd_dS.diminfo[0].shape;
14569  if (unlikely(__pyx_t_18 < 0)) __pyx_t_13 = 0;
14570  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_dS.diminfo[0].shape)) __pyx_t_13 = 0;
14571  if (__pyx_t_19 < 0) {
14572  __pyx_t_19 += __pyx_pybuffernd_dS.diminfo[1].shape;
14573  if (unlikely(__pyx_t_19 < 0)) __pyx_t_13 = 1;
14574  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_dS.diminfo[1].shape)) __pyx_t_13 = 1;
14575  if (__pyx_t_20 < 0) {
14576  __pyx_t_20 += __pyx_pybuffernd_dS.diminfo[2].shape;
14577  if (unlikely(__pyx_t_20 < 0)) __pyx_t_13 = 2;
14578  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_dS.diminfo[2].shape)) __pyx_t_13 = 2;
14579  if (unlikely(__pyx_t_13 != -1)) {
14580  __Pyx_RaiseBufferIndexError(__pyx_t_13);
14581  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14582  }
14583  __pyx_v_integral = (__pyx_v_integral + (((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_11, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[3].strides)) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_n.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_n.diminfo[1].strides, __pyx_t_16, __pyx_pybuffernd_n.diminfo[2].strides, __pyx_t_17, __pyx_pybuffernd_n.diminfo[3].strides))) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dS.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_dS.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_dS.diminfo[1].strides, __pyx_t_20, __pyx_pybuffernd_dS.diminfo[2].strides))));
14584  }
14585  }
14586 
14587  /* "subsurfaceTransportFunctions.pyx":730
14588  * for I in range(n.shape[3]):
14589  * integral += v[eN,ebN,kb,I]*n[eN,ebN,kb,I]*dS[eN,ebN,kb]
14590  * flux[eN,ebN] = integral # <<<<<<<<<<<<<<
14591  *
14592  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df,
14593  */
14594  __pyx_t_21 = __pyx_v_eN;
14595  __pyx_t_22 = __pyx_v_ebN;
14596  __pyx_t_6 = -1;
14597  if (__pyx_t_21 < 0) {
14598  __pyx_t_21 += __pyx_pybuffernd_flux.diminfo[0].shape;
14599  if (unlikely(__pyx_t_21 < 0)) __pyx_t_6 = 0;
14600  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_flux.diminfo[0].shape)) __pyx_t_6 = 0;
14601  if (__pyx_t_22 < 0) {
14602  __pyx_t_22 += __pyx_pybuffernd_flux.diminfo[1].shape;
14603  if (unlikely(__pyx_t_22 < 0)) __pyx_t_6 = 1;
14604  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_flux.diminfo[1].shape)) __pyx_t_6 = 1;
14605  if (unlikely(__pyx_t_6 != -1)) {
14606  __Pyx_RaiseBufferIndexError(__pyx_t_6);
14607  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14608  }
14609  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_flux.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_flux.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_flux.diminfo[1].strides) = __pyx_v_integral;
14610  }
14611  }
14612 
14613  /* "subsurfaceTransportFunctions.pyx":717
14614  * #ELLAM
14615  * ########################################################################
14616  * def calculateNormalFlux(numpy.ndarray[DTYPE_t,ndim=4] v, # <<<<<<<<<<<<<<
14617  * numpy.ndarray[DTYPE_t,ndim=4] n,
14618  * numpy.ndarray[DTYPE_t,ndim=3] dS,
14619  */
14620 
14621  /* function exit code */
14622  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14623  goto __pyx_L0;
14624  __pyx_L1_error:;
14625  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
14626  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
14627  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
14628  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_flux.rcbuffer->pybuffer);
14629  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_n.rcbuffer->pybuffer);
14630  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
14631  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
14632  __Pyx_AddTraceback("subsurfaceTransportFunctions.calculateNormalFlux", __pyx_clineno, __pyx_lineno, __pyx_filename);
14633  __pyx_r = NULL;
14634  goto __pyx_L2;
14635  __pyx_L0:;
14636  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
14637  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_flux.rcbuffer->pybuffer);
14638  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_n.rcbuffer->pybuffer);
14639  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
14640  __pyx_L2:;
14641  __Pyx_XGIVEREF(__pyx_r);
14642  __Pyx_RefNannyFinishContext();
14643  return __pyx_r;
14644 }
14645 
14646 /* "subsurfaceTransportFunctions.pyx":732
14647  * flux[eN,ebN] = integral
14648  *
14649  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df, # <<<<<<<<<<<<<<
14650  * numpy.ndarray[DTYPE_t,ndim=3] characteristic_velocity,
14651  * numpy.ndarray[DTYPE_t,ndim=2] dm,
14652  */
14653 
14654 /* Python wrapper */
14655 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
14656 static char __pyx_doc_28subsurfaceTransportFunctions_42computeSimpleCharacteristicVelocityFromElementVelocity[] = "\n simple approximation for \\lambda = df/\010ar{dm} using \010ar{dm} = \014rac{1}{\\Omega_e} \\int_{\\Omega_e} dm dV\n ";
14657 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity = {"computeSimpleCharacteristicVelocityFromElementVelocity", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_42computeSimpleCharacteristicVelocityFromElementVelocity};
14658 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
14659  PyArrayObject *__pyx_v_df = 0;
14660  PyArrayObject *__pyx_v_characteristic_velocity = 0;
14661  PyArrayObject *__pyx_v_dm = 0;
14662  PyArrayObject *__pyx_v_dV = 0;
14663  int __pyx_lineno = 0;
14664  const char *__pyx_filename = NULL;
14665  int __pyx_clineno = 0;
14666  PyObject *__pyx_r = 0;
14667  __Pyx_RefNannyDeclarations
14668  __Pyx_RefNannySetupContext("computeSimpleCharacteristicVelocityFromElementVelocity (wrapper)", 0);
14669  {
14670  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_df,&__pyx_n_s_characteristic_velocity,&__pyx_n_s_dm,&__pyx_n_s_dV,0};
14671  PyObject* values[4] = {0,0,0,0};
14672  if (unlikely(__pyx_kwds)) {
14673  Py_ssize_t kw_args;
14674  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
14675  switch (pos_args) {
14676  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
14677  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
14678  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
14679  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
14680  case 0: break;
14681  default: goto __pyx_L5_argtuple_error;
14682  }
14683  kw_args = PyDict_Size(__pyx_kwds);
14684  switch (pos_args) {
14685  case 0:
14686  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_df)) != 0)) kw_args--;
14687  else goto __pyx_L5_argtuple_error;
14688  case 1:
14689  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_characteristic_velocity)) != 0)) kw_args--;
14690  else {
14691  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromElementVelocity", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
14692  }
14693  case 2:
14694  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dm)) != 0)) kw_args--;
14695  else {
14696  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromElementVelocity", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
14697  }
14698  case 3:
14699  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dV)) != 0)) kw_args--;
14700  else {
14701  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromElementVelocity", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
14702  }
14703  }
14704  if (unlikely(kw_args > 0)) {
14705  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "computeSimpleCharacteristicVelocityFromElementVelocity") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
14706  }
14707  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
14708  goto __pyx_L5_argtuple_error;
14709  } else {
14710  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
14711  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
14712  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
14713  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
14714  }
14715  __pyx_v_df = ((PyArrayObject *)values[0]);
14716  __pyx_v_characteristic_velocity = ((PyArrayObject *)values[1]);
14717  __pyx_v_dm = ((PyArrayObject *)values[2]);
14718  __pyx_v_dV = ((PyArrayObject *)values[3]);
14719  }
14720  goto __pyx_L4_argument_unpacking_done;
14721  __pyx_L5_argtuple_error:;
14722  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromElementVelocity", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
14723  __pyx_L3_error:;
14724  __Pyx_AddTraceback("subsurfaceTransportFunctions.computeSimpleCharacteristicVelocityFromElementVelocity", __pyx_clineno, __pyx_lineno, __pyx_filename);
14725  __Pyx_RefNannyFinishContext();
14726  return NULL;
14727  __pyx_L4_argument_unpacking_done:;
14728  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_df), __pyx_ptype_5numpy_ndarray, 1, "df", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14729  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_characteristic_velocity), __pyx_ptype_5numpy_ndarray, 1, "characteristic_velocity", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14730  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dm), __pyx_ptype_5numpy_ndarray, 1, "dm", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14731  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dV), __pyx_ptype_5numpy_ndarray, 1, "dV", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14732  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_42computeSimpleCharacteristicVelocityFromElementVelocity(__pyx_self, __pyx_v_df, __pyx_v_characteristic_velocity, __pyx_v_dm, __pyx_v_dV);
14733 
14734  /* function exit code */
14735  goto __pyx_L0;
14736  __pyx_L1_error:;
14737  __pyx_r = NULL;
14738  __pyx_L0:;
14739  __Pyx_RefNannyFinishContext();
14740  return __pyx_r;
14741 }
14742 
14743 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_42computeSimpleCharacteristicVelocityFromElementVelocity(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_df, PyArrayObject *__pyx_v_characteristic_velocity, PyArrayObject *__pyx_v_dm, PyArrayObject *__pyx_v_dV) {
14744  int __pyx_v_eN;
14745  int __pyx_v_k;
14746  int __pyx_v_I;
14747  double __pyx_v_omega_e;
14748  double __pyx_v_vol_e;
14749  __Pyx_LocalBuf_ND __pyx_pybuffernd_characteristic_velocity;
14750  __Pyx_Buffer __pyx_pybuffer_characteristic_velocity;
14751  __Pyx_LocalBuf_ND __pyx_pybuffernd_dV;
14752  __Pyx_Buffer __pyx_pybuffer_dV;
14753  __Pyx_LocalBuf_ND __pyx_pybuffernd_df;
14754  __Pyx_Buffer __pyx_pybuffer_df;
14755  __Pyx_LocalBuf_ND __pyx_pybuffernd_dm;
14756  __Pyx_Buffer __pyx_pybuffer_dm;
14757  PyObject *__pyx_r = NULL;
14758  __Pyx_RefNannyDeclarations
14759  npy_intp __pyx_t_1;
14760  int __pyx_t_2;
14761  npy_intp __pyx_t_3;
14762  int __pyx_t_4;
14763  Py_ssize_t __pyx_t_5;
14764  Py_ssize_t __pyx_t_6;
14765  int __pyx_t_7;
14766  Py_ssize_t __pyx_t_8;
14767  Py_ssize_t __pyx_t_9;
14768  Py_ssize_t __pyx_t_10;
14769  Py_ssize_t __pyx_t_11;
14770  npy_intp __pyx_t_12;
14771  Py_ssize_t __pyx_t_13;
14772  Py_ssize_t __pyx_t_14;
14773  Py_ssize_t __pyx_t_15;
14774  int __pyx_t_16;
14775  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_17;
14776  double __pyx_t_18;
14777  Py_ssize_t __pyx_t_19;
14778  Py_ssize_t __pyx_t_20;
14779  Py_ssize_t __pyx_t_21;
14780  int __pyx_lineno = 0;
14781  const char *__pyx_filename = NULL;
14782  int __pyx_clineno = 0;
14783  __Pyx_RefNannySetupContext("computeSimpleCharacteristicVelocityFromElementVelocity", 0);
14784  __pyx_pybuffer_df.pybuffer.buf = NULL;
14785  __pyx_pybuffer_df.refcount = 0;
14786  __pyx_pybuffernd_df.data = NULL;
14787  __pyx_pybuffernd_df.rcbuffer = &__pyx_pybuffer_df;
14788  __pyx_pybuffer_characteristic_velocity.pybuffer.buf = NULL;
14789  __pyx_pybuffer_characteristic_velocity.refcount = 0;
14790  __pyx_pybuffernd_characteristic_velocity.data = NULL;
14791  __pyx_pybuffernd_characteristic_velocity.rcbuffer = &__pyx_pybuffer_characteristic_velocity;
14792  __pyx_pybuffer_dm.pybuffer.buf = NULL;
14793  __pyx_pybuffer_dm.refcount = 0;
14794  __pyx_pybuffernd_dm.data = NULL;
14795  __pyx_pybuffernd_dm.rcbuffer = &__pyx_pybuffer_dm;
14796  __pyx_pybuffer_dV.pybuffer.buf = NULL;
14797  __pyx_pybuffer_dV.refcount = 0;
14798  __pyx_pybuffernd_dV.data = NULL;
14799  __pyx_pybuffernd_dV.rcbuffer = &__pyx_pybuffer_dV;
14800  {
14801  __Pyx_BufFmt_StackElem __pyx_stack[1];
14802  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_df.rcbuffer->pybuffer, (PyObject*)__pyx_v_df, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14803  }
14804  __pyx_pybuffernd_df.diminfo[0].strides = __pyx_pybuffernd_df.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_df.diminfo[0].shape = __pyx_pybuffernd_df.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_df.diminfo[1].strides = __pyx_pybuffernd_df.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_df.diminfo[1].shape = __pyx_pybuffernd_df.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_df.diminfo[2].strides = __pyx_pybuffernd_df.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_df.diminfo[2].shape = __pyx_pybuffernd_df.rcbuffer->pybuffer.shape[2];
14805  {
14806  __Pyx_BufFmt_StackElem __pyx_stack[1];
14807  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer, (PyObject*)__pyx_v_characteristic_velocity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14808  }
14809  __pyx_pybuffernd_characteristic_velocity.diminfo[0].strides = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_characteristic_velocity.diminfo[0].shape = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_characteristic_velocity.diminfo[1].strides = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_characteristic_velocity.diminfo[1].shape = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_characteristic_velocity.diminfo[2].strides = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_characteristic_velocity.diminfo[2].shape = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.shape[2];
14810  {
14811  __Pyx_BufFmt_StackElem __pyx_stack[1];
14812  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dm.rcbuffer->pybuffer, (PyObject*)__pyx_v_dm, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14813  }
14814  __pyx_pybuffernd_dm.diminfo[0].strides = __pyx_pybuffernd_dm.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dm.diminfo[0].shape = __pyx_pybuffernd_dm.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dm.diminfo[1].strides = __pyx_pybuffernd_dm.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dm.diminfo[1].shape = __pyx_pybuffernd_dm.rcbuffer->pybuffer.shape[1];
14815  {
14816  __Pyx_BufFmt_StackElem __pyx_stack[1];
14817  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_v_dV, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14818  }
14819  __pyx_pybuffernd_dV.diminfo[0].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dV.diminfo[0].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dV.diminfo[1].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dV.diminfo[1].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[1];
14820 
14821  /* "subsurfaceTransportFunctions.pyx":743
14822  * cdef double omega_e, vol_e
14823  *
14824  * for eN in range(dm.shape[0]): # <<<<<<<<<<<<<<
14825  * omega_e = 0.0
14826  * vol_e = 0.0
14827  */
14828  __pyx_t_1 = (__pyx_v_dm->dimensions[0]);
14829  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
14830  __pyx_v_eN = __pyx_t_2;
14831 
14832  /* "subsurfaceTransportFunctions.pyx":744
14833  *
14834  * for eN in range(dm.shape[0]):
14835  * omega_e = 0.0 # <<<<<<<<<<<<<<
14836  * vol_e = 0.0
14837  * for k in range(dm.shape[1]):
14838  */
14839  __pyx_v_omega_e = 0.0;
14840 
14841  /* "subsurfaceTransportFunctions.pyx":745
14842  * for eN in range(dm.shape[0]):
14843  * omega_e = 0.0
14844  * vol_e = 0.0 # <<<<<<<<<<<<<<
14845  * for k in range(dm.shape[1]):
14846  * vol_e += dV[eN,k]
14847  */
14848  __pyx_v_vol_e = 0.0;
14849 
14850  /* "subsurfaceTransportFunctions.pyx":746
14851  * omega_e = 0.0
14852  * vol_e = 0.0
14853  * for k in range(dm.shape[1]): # <<<<<<<<<<<<<<
14854  * vol_e += dV[eN,k]
14855  * omega_e += dV[eN,k]*dm[eN,k]
14856  */
14857  __pyx_t_3 = (__pyx_v_dm->dimensions[1]);
14858  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
14859  __pyx_v_k = __pyx_t_4;
14860 
14861  /* "subsurfaceTransportFunctions.pyx":747
14862  * vol_e = 0.0
14863  * for k in range(dm.shape[1]):
14864  * vol_e += dV[eN,k] # <<<<<<<<<<<<<<
14865  * omega_e += dV[eN,k]*dm[eN,k]
14866  * for k in range(df.shape[1]):
14867  */
14868  __pyx_t_5 = __pyx_v_eN;
14869  __pyx_t_6 = __pyx_v_k;
14870  __pyx_t_7 = -1;
14871  if (__pyx_t_5 < 0) {
14872  __pyx_t_5 += __pyx_pybuffernd_dV.diminfo[0].shape;
14873  if (unlikely(__pyx_t_5 < 0)) __pyx_t_7 = 0;
14874  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_7 = 0;
14875  if (__pyx_t_6 < 0) {
14876  __pyx_t_6 += __pyx_pybuffernd_dV.diminfo[1].shape;
14877  if (unlikely(__pyx_t_6 < 0)) __pyx_t_7 = 1;
14878  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_7 = 1;
14879  if (unlikely(__pyx_t_7 != -1)) {
14880  __Pyx_RaiseBufferIndexError(__pyx_t_7);
14881  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14882  }
14883  __pyx_v_vol_e = (__pyx_v_vol_e + (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_dV.diminfo[1].strides)));
14884 
14885  /* "subsurfaceTransportFunctions.pyx":748
14886  * for k in range(dm.shape[1]):
14887  * vol_e += dV[eN,k]
14888  * omega_e += dV[eN,k]*dm[eN,k] # <<<<<<<<<<<<<<
14889  * for k in range(df.shape[1]):
14890  * for I in range(df.shape[2]):
14891  */
14892  __pyx_t_8 = __pyx_v_eN;
14893  __pyx_t_9 = __pyx_v_k;
14894  __pyx_t_7 = -1;
14895  if (__pyx_t_8 < 0) {
14896  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[0].shape;
14897  if (unlikely(__pyx_t_8 < 0)) __pyx_t_7 = 0;
14898  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_7 = 0;
14899  if (__pyx_t_9 < 0) {
14900  __pyx_t_9 += __pyx_pybuffernd_dV.diminfo[1].shape;
14901  if (unlikely(__pyx_t_9 < 0)) __pyx_t_7 = 1;
14902  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_7 = 1;
14903  if (unlikely(__pyx_t_7 != -1)) {
14904  __Pyx_RaiseBufferIndexError(__pyx_t_7);
14905  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14906  }
14907  __pyx_t_10 = __pyx_v_eN;
14908  __pyx_t_11 = __pyx_v_k;
14909  __pyx_t_7 = -1;
14910  if (__pyx_t_10 < 0) {
14911  __pyx_t_10 += __pyx_pybuffernd_dm.diminfo[0].shape;
14912  if (unlikely(__pyx_t_10 < 0)) __pyx_t_7 = 0;
14913  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_dm.diminfo[0].shape)) __pyx_t_7 = 0;
14914  if (__pyx_t_11 < 0) {
14915  __pyx_t_11 += __pyx_pybuffernd_dm.diminfo[1].shape;
14916  if (unlikely(__pyx_t_11 < 0)) __pyx_t_7 = 1;
14917  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_dm.diminfo[1].shape)) __pyx_t_7 = 1;
14918  if (unlikely(__pyx_t_7 != -1)) {
14919  __Pyx_RaiseBufferIndexError(__pyx_t_7);
14920  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14921  }
14922  __pyx_v_omega_e = (__pyx_v_omega_e + ((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_dV.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dm.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_dm.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_dm.diminfo[1].strides))));
14923  }
14924 
14925  /* "subsurfaceTransportFunctions.pyx":749
14926  * vol_e += dV[eN,k]
14927  * omega_e += dV[eN,k]*dm[eN,k]
14928  * for k in range(df.shape[1]): # <<<<<<<<<<<<<<
14929  * for I in range(df.shape[2]):
14930  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
14931  */
14932  __pyx_t_3 = (__pyx_v_df->dimensions[1]);
14933  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
14934  __pyx_v_k = __pyx_t_4;
14935 
14936  /* "subsurfaceTransportFunctions.pyx":750
14937  * omega_e += dV[eN,k]*dm[eN,k]
14938  * for k in range(df.shape[1]):
14939  * for I in range(df.shape[2]): # <<<<<<<<<<<<<<
14940  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
14941  *
14942  */
14943  __pyx_t_12 = (__pyx_v_df->dimensions[2]);
14944  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_12; __pyx_t_7+=1) {
14945  __pyx_v_I = __pyx_t_7;
14946 
14947  /* "subsurfaceTransportFunctions.pyx":751
14948  * for k in range(df.shape[1]):
14949  * for I in range(df.shape[2]):
14950  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12) # <<<<<<<<<<<<<<
14951  *
14952  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs,
14953  */
14954  __pyx_t_13 = __pyx_v_eN;
14955  __pyx_t_14 = __pyx_v_k;
14956  __pyx_t_15 = __pyx_v_I;
14957  __pyx_t_16 = -1;
14958  if (__pyx_t_13 < 0) {
14959  __pyx_t_13 += __pyx_pybuffernd_df.diminfo[0].shape;
14960  if (unlikely(__pyx_t_13 < 0)) __pyx_t_16 = 0;
14961  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_df.diminfo[0].shape)) __pyx_t_16 = 0;
14962  if (__pyx_t_14 < 0) {
14963  __pyx_t_14 += __pyx_pybuffernd_df.diminfo[1].shape;
14964  if (unlikely(__pyx_t_14 < 0)) __pyx_t_16 = 1;
14965  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_df.diminfo[1].shape)) __pyx_t_16 = 1;
14966  if (__pyx_t_15 < 0) {
14967  __pyx_t_15 += __pyx_pybuffernd_df.diminfo[2].shape;
14968  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 2;
14969  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_df.diminfo[2].shape)) __pyx_t_16 = 2;
14970  if (unlikely(__pyx_t_16 != -1)) {
14971  __Pyx_RaiseBufferIndexError(__pyx_t_16);
14972  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14973  }
14974  __pyx_t_17 = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_df.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_df.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_df.diminfo[1].strides, __pyx_t_15, __pyx_pybuffernd_df.diminfo[2].strides)) * __pyx_v_vol_e);
14975  __pyx_t_18 = (__pyx_v_omega_e + 1.0e-12);
14976  if (unlikely(__pyx_t_18 == 0)) {
14977  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
14978  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14979  }
14980  __pyx_t_19 = __pyx_v_eN;
14981  __pyx_t_20 = __pyx_v_k;
14982  __pyx_t_21 = __pyx_v_I;
14983  __pyx_t_16 = -1;
14984  if (__pyx_t_19 < 0) {
14985  __pyx_t_19 += __pyx_pybuffernd_characteristic_velocity.diminfo[0].shape;
14986  if (unlikely(__pyx_t_19 < 0)) __pyx_t_16 = 0;
14987  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_characteristic_velocity.diminfo[0].shape)) __pyx_t_16 = 0;
14988  if (__pyx_t_20 < 0) {
14989  __pyx_t_20 += __pyx_pybuffernd_characteristic_velocity.diminfo[1].shape;
14990  if (unlikely(__pyx_t_20 < 0)) __pyx_t_16 = 1;
14991  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_characteristic_velocity.diminfo[1].shape)) __pyx_t_16 = 1;
14992  if (__pyx_t_21 < 0) {
14993  __pyx_t_21 += __pyx_pybuffernd_characteristic_velocity.diminfo[2].shape;
14994  if (unlikely(__pyx_t_21 < 0)) __pyx_t_16 = 2;
14995  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_characteristic_velocity.diminfo[2].shape)) __pyx_t_16 = 2;
14996  if (unlikely(__pyx_t_16 != -1)) {
14997  __Pyx_RaiseBufferIndexError(__pyx_t_16);
14998  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14999  }
15000  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_characteristic_velocity.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_characteristic_velocity.diminfo[1].strides, __pyx_t_21, __pyx_pybuffernd_characteristic_velocity.diminfo[2].strides) = (__pyx_t_17 / __pyx_t_18);
15001  }
15002  }
15003  }
15004 
15005  /* "subsurfaceTransportFunctions.pyx":732
15006  * flux[eN,ebN] = integral
15007  *
15008  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df, # <<<<<<<<<<<<<<
15009  * numpy.ndarray[DTYPE_t,ndim=3] characteristic_velocity,
15010  * numpy.ndarray[DTYPE_t,ndim=2] dm,
15011  */
15012 
15013  /* function exit code */
15014  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15015  goto __pyx_L0;
15016  __pyx_L1_error:;
15017  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
15018  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
15019  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer);
15020  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
15021  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_df.rcbuffer->pybuffer);
15022  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dm.rcbuffer->pybuffer);
15023  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
15024  __Pyx_AddTraceback("subsurfaceTransportFunctions.computeSimpleCharacteristicVelocityFromElementVelocity", __pyx_clineno, __pyx_lineno, __pyx_filename);
15025  __pyx_r = NULL;
15026  goto __pyx_L2;
15027  __pyx_L0:;
15028  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer);
15029  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
15030  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_df.rcbuffer->pybuffer);
15031  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dm.rcbuffer->pybuffer);
15032  __pyx_L2:;
15033  __Pyx_XGIVEREF(__pyx_r);
15034  __Pyx_RefNannyFinishContext();
15035  return __pyx_r;
15036 }
15037 
15038 /* "subsurfaceTransportFunctions.pyx":753
15039  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
15040  *
15041  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs, # <<<<<<<<<<<<<<
15042  * numpy.ndarray[DTYPE_t,ndim=1] characteristic_velocity_dofs,
15043  * numpy.ndarray[ITYPE_t,ndim=2] l2g,
15044  */
15045 
15046 /* Python wrapper */
15047 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
15048 static char __pyx_doc_28subsurfaceTransportFunctions_44computeSimpleCharacteristicVelocityFromVelocityDOFs[] = "\n simple approximation for \\lambda = df/\010ar{dm} using \010ar{dm} = \014rac{1}{\\Omega_e} \\int_{\\Omega_e} dm dV\n ";
15049 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs = {"computeSimpleCharacteristicVelocityFromVelocityDOFs", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_44computeSimpleCharacteristicVelocityFromVelocityDOFs};
15050 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
15051  PyArrayObject *__pyx_v_df_dofs = 0;
15052  PyArrayObject *__pyx_v_characteristic_velocity_dofs = 0;
15053  PyArrayObject *__pyx_v_l2g = 0;
15054  PyArrayObject *__pyx_v_dm = 0;
15055  PyArrayObject *__pyx_v_dV = 0;
15056  int __pyx_lineno = 0;
15057  const char *__pyx_filename = NULL;
15058  int __pyx_clineno = 0;
15059  PyObject *__pyx_r = 0;
15060  __Pyx_RefNannyDeclarations
15061  __Pyx_RefNannySetupContext("computeSimpleCharacteristicVelocityFromVelocityDOFs (wrapper)", 0);
15062  {
15063  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_df_dofs,&__pyx_n_s_characteristic_velocity_dofs,&__pyx_n_s_l2g,&__pyx_n_s_dm,&__pyx_n_s_dV,0};
15064  PyObject* values[5] = {0,0,0,0,0};
15065  if (unlikely(__pyx_kwds)) {
15066  Py_ssize_t kw_args;
15067  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
15068  switch (pos_args) {
15069  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
15070  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15071  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15072  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15073  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15074  case 0: break;
15075  default: goto __pyx_L5_argtuple_error;
15076  }
15077  kw_args = PyDict_Size(__pyx_kwds);
15078  switch (pos_args) {
15079  case 0:
15080  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_df_dofs)) != 0)) kw_args--;
15081  else goto __pyx_L5_argtuple_error;
15082  case 1:
15083  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_characteristic_velocity_dofs)) != 0)) kw_args--;
15084  else {
15085  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
15086  }
15087  case 2:
15088  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_l2g)) != 0)) kw_args--;
15089  else {
15090  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
15091  }
15092  case 3:
15093  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dm)) != 0)) kw_args--;
15094  else {
15095  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
15096  }
15097  case 4:
15098  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dV)) != 0)) kw_args--;
15099  else {
15100  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
15101  }
15102  }
15103  if (unlikely(kw_args > 0)) {
15104  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "computeSimpleCharacteristicVelocityFromVelocityDOFs") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
15105  }
15106  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
15107  goto __pyx_L5_argtuple_error;
15108  } else {
15109  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15110  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15111  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15112  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15113  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
15114  }
15115  __pyx_v_df_dofs = ((PyArrayObject *)values[0]);
15116  __pyx_v_characteristic_velocity_dofs = ((PyArrayObject *)values[1]);
15117  __pyx_v_l2g = ((PyArrayObject *)values[2]);
15118  __pyx_v_dm = ((PyArrayObject *)values[3]);
15119  __pyx_v_dV = ((PyArrayObject *)values[4]);
15120  }
15121  goto __pyx_L4_argument_unpacking_done;
15122  __pyx_L5_argtuple_error:;
15123  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
15124  __pyx_L3_error:;
15125  __Pyx_AddTraceback("subsurfaceTransportFunctions.computeSimpleCharacteristicVelocityFromVelocityDOFs", __pyx_clineno, __pyx_lineno, __pyx_filename);
15126  __Pyx_RefNannyFinishContext();
15127  return NULL;
15128  __pyx_L4_argument_unpacking_done:;
15129  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_df_dofs), __pyx_ptype_5numpy_ndarray, 1, "df_dofs", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15130  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_characteristic_velocity_dofs), __pyx_ptype_5numpy_ndarray, 1, "characteristic_velocity_dofs", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15131  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_l2g), __pyx_ptype_5numpy_ndarray, 1, "l2g", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15132  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dm), __pyx_ptype_5numpy_ndarray, 1, "dm", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15133  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dV), __pyx_ptype_5numpy_ndarray, 1, "dV", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15134  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_44computeSimpleCharacteristicVelocityFromVelocityDOFs(__pyx_self, __pyx_v_df_dofs, __pyx_v_characteristic_velocity_dofs, __pyx_v_l2g, __pyx_v_dm, __pyx_v_dV);
15135 
15136  /* function exit code */
15137  goto __pyx_L0;
15138  __pyx_L1_error:;
15139  __pyx_r = NULL;
15140  __pyx_L0:;
15141  __Pyx_RefNannyFinishContext();
15142  return __pyx_r;
15143 }
15144 
15145 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_44computeSimpleCharacteristicVelocityFromVelocityDOFs(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_df_dofs, PyArrayObject *__pyx_v_characteristic_velocity_dofs, PyArrayObject *__pyx_v_l2g, PyArrayObject *__pyx_v_dm, PyArrayObject *__pyx_v_dV) {
15146  int __pyx_v_eN;
15147  int __pyx_v_k;
15148  int __pyx_v_j;
15149  int __pyx_v_J;
15150  double __pyx_v_omega_e;
15151  double __pyx_v_vol_e;
15152  __Pyx_LocalBuf_ND __pyx_pybuffernd_characteristic_velocity_dofs;
15153  __Pyx_Buffer __pyx_pybuffer_characteristic_velocity_dofs;
15154  __Pyx_LocalBuf_ND __pyx_pybuffernd_dV;
15155  __Pyx_Buffer __pyx_pybuffer_dV;
15156  __Pyx_LocalBuf_ND __pyx_pybuffernd_df_dofs;
15157  __Pyx_Buffer __pyx_pybuffer_df_dofs;
15158  __Pyx_LocalBuf_ND __pyx_pybuffernd_dm;
15159  __Pyx_Buffer __pyx_pybuffer_dm;
15160  __Pyx_LocalBuf_ND __pyx_pybuffernd_l2g;
15161  __Pyx_Buffer __pyx_pybuffer_l2g;
15162  PyObject *__pyx_r = NULL;
15163  __Pyx_RefNannyDeclarations
15164  npy_intp __pyx_t_1;
15165  int __pyx_t_2;
15166  npy_intp __pyx_t_3;
15167  int __pyx_t_4;
15168  Py_ssize_t __pyx_t_5;
15169  Py_ssize_t __pyx_t_6;
15170  int __pyx_t_7;
15171  Py_ssize_t __pyx_t_8;
15172  Py_ssize_t __pyx_t_9;
15173  Py_ssize_t __pyx_t_10;
15174  Py_ssize_t __pyx_t_11;
15175  Py_ssize_t __pyx_t_12;
15176  Py_ssize_t __pyx_t_13;
15177  Py_ssize_t __pyx_t_14;
15178  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_15;
15179  double __pyx_t_16;
15180  Py_ssize_t __pyx_t_17;
15181  int __pyx_lineno = 0;
15182  const char *__pyx_filename = NULL;
15183  int __pyx_clineno = 0;
15184  __Pyx_RefNannySetupContext("computeSimpleCharacteristicVelocityFromVelocityDOFs", 0);
15185  __pyx_pybuffer_df_dofs.pybuffer.buf = NULL;
15186  __pyx_pybuffer_df_dofs.refcount = 0;
15187  __pyx_pybuffernd_df_dofs.data = NULL;
15188  __pyx_pybuffernd_df_dofs.rcbuffer = &__pyx_pybuffer_df_dofs;
15189  __pyx_pybuffer_characteristic_velocity_dofs.pybuffer.buf = NULL;
15190  __pyx_pybuffer_characteristic_velocity_dofs.refcount = 0;
15191  __pyx_pybuffernd_characteristic_velocity_dofs.data = NULL;
15192  __pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer = &__pyx_pybuffer_characteristic_velocity_dofs;
15193  __pyx_pybuffer_l2g.pybuffer.buf = NULL;
15194  __pyx_pybuffer_l2g.refcount = 0;
15195  __pyx_pybuffernd_l2g.data = NULL;
15196  __pyx_pybuffernd_l2g.rcbuffer = &__pyx_pybuffer_l2g;
15197  __pyx_pybuffer_dm.pybuffer.buf = NULL;
15198  __pyx_pybuffer_dm.refcount = 0;
15199  __pyx_pybuffernd_dm.data = NULL;
15200  __pyx_pybuffernd_dm.rcbuffer = &__pyx_pybuffer_dm;
15201  __pyx_pybuffer_dV.pybuffer.buf = NULL;
15202  __pyx_pybuffer_dV.refcount = 0;
15203  __pyx_pybuffernd_dV.data = NULL;
15204  __pyx_pybuffernd_dV.rcbuffer = &__pyx_pybuffer_dV;
15205  {
15206  __Pyx_BufFmt_StackElem __pyx_stack[1];
15207  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_df_dofs.rcbuffer->pybuffer, (PyObject*)__pyx_v_df_dofs, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15208  }
15209  __pyx_pybuffernd_df_dofs.diminfo[0].strides = __pyx_pybuffernd_df_dofs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_df_dofs.diminfo[0].shape = __pyx_pybuffernd_df_dofs.rcbuffer->pybuffer.shape[0];
15210  {
15211  __Pyx_BufFmt_StackElem __pyx_stack[1];
15212  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer, (PyObject*)__pyx_v_characteristic_velocity_dofs, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15213  }
15214  __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].strides = __pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].shape = __pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer.shape[0];
15215  {
15216  __Pyx_BufFmt_StackElem __pyx_stack[1];
15217  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_l2g.rcbuffer->pybuffer, (PyObject*)__pyx_v_l2g, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15218  }
15219  __pyx_pybuffernd_l2g.diminfo[0].strides = __pyx_pybuffernd_l2g.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_l2g.diminfo[0].shape = __pyx_pybuffernd_l2g.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_l2g.diminfo[1].strides = __pyx_pybuffernd_l2g.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_l2g.diminfo[1].shape = __pyx_pybuffernd_l2g.rcbuffer->pybuffer.shape[1];
15220  {
15221  __Pyx_BufFmt_StackElem __pyx_stack[1];
15222  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dm.rcbuffer->pybuffer, (PyObject*)__pyx_v_dm, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15223  }
15224  __pyx_pybuffernd_dm.diminfo[0].strides = __pyx_pybuffernd_dm.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dm.diminfo[0].shape = __pyx_pybuffernd_dm.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dm.diminfo[1].strides = __pyx_pybuffernd_dm.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dm.diminfo[1].shape = __pyx_pybuffernd_dm.rcbuffer->pybuffer.shape[1];
15225  {
15226  __Pyx_BufFmt_StackElem __pyx_stack[1];
15227  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_v_dV, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15228  }
15229  __pyx_pybuffernd_dV.diminfo[0].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dV.diminfo[0].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dV.diminfo[1].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dV.diminfo[1].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[1];
15230 
15231  /* "subsurfaceTransportFunctions.pyx":765
15232  * cdef double omega_e, vol_e
15233  *
15234  * for eN in range(dm.shape[0]): # <<<<<<<<<<<<<<
15235  * omega_e = 0.0
15236  * vol_e = 0.0
15237  */
15238  __pyx_t_1 = (__pyx_v_dm->dimensions[0]);
15239  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
15240  __pyx_v_eN = __pyx_t_2;
15241 
15242  /* "subsurfaceTransportFunctions.pyx":766
15243  *
15244  * for eN in range(dm.shape[0]):
15245  * omega_e = 0.0 # <<<<<<<<<<<<<<
15246  * vol_e = 0.0
15247  * for k in range(dm.shape[1]):
15248  */
15249  __pyx_v_omega_e = 0.0;
15250 
15251  /* "subsurfaceTransportFunctions.pyx":767
15252  * for eN in range(dm.shape[0]):
15253  * omega_e = 0.0
15254  * vol_e = 0.0 # <<<<<<<<<<<<<<
15255  * for k in range(dm.shape[1]):
15256  * vol_e += dV[eN,k]
15257  */
15258  __pyx_v_vol_e = 0.0;
15259 
15260  /* "subsurfaceTransportFunctions.pyx":768
15261  * omega_e = 0.0
15262  * vol_e = 0.0
15263  * for k in range(dm.shape[1]): # <<<<<<<<<<<<<<
15264  * vol_e += dV[eN,k]
15265  * omega_e += dV[eN,k]*dm[eN,k]
15266  */
15267  __pyx_t_3 = (__pyx_v_dm->dimensions[1]);
15268  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
15269  __pyx_v_k = __pyx_t_4;
15270 
15271  /* "subsurfaceTransportFunctions.pyx":769
15272  * vol_e = 0.0
15273  * for k in range(dm.shape[1]):
15274  * vol_e += dV[eN,k] # <<<<<<<<<<<<<<
15275  * omega_e += dV[eN,k]*dm[eN,k]
15276  * for j in range(l2g.shape[1]):
15277  */
15278  __pyx_t_5 = __pyx_v_eN;
15279  __pyx_t_6 = __pyx_v_k;
15280  __pyx_t_7 = -1;
15281  if (__pyx_t_5 < 0) {
15282  __pyx_t_5 += __pyx_pybuffernd_dV.diminfo[0].shape;
15283  if (unlikely(__pyx_t_5 < 0)) __pyx_t_7 = 0;
15284  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_7 = 0;
15285  if (__pyx_t_6 < 0) {
15286  __pyx_t_6 += __pyx_pybuffernd_dV.diminfo[1].shape;
15287  if (unlikely(__pyx_t_6 < 0)) __pyx_t_7 = 1;
15288  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_7 = 1;
15289  if (unlikely(__pyx_t_7 != -1)) {
15290  __Pyx_RaiseBufferIndexError(__pyx_t_7);
15291  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15292  }
15293  __pyx_v_vol_e = (__pyx_v_vol_e + (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_dV.diminfo[1].strides)));
15294 
15295  /* "subsurfaceTransportFunctions.pyx":770
15296  * for k in range(dm.shape[1]):
15297  * vol_e += dV[eN,k]
15298  * omega_e += dV[eN,k]*dm[eN,k] # <<<<<<<<<<<<<<
15299  * for j in range(l2g.shape[1]):
15300  * J = l2g[eN,j]
15301  */
15302  __pyx_t_8 = __pyx_v_eN;
15303  __pyx_t_9 = __pyx_v_k;
15304  __pyx_t_7 = -1;
15305  if (__pyx_t_8 < 0) {
15306  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[0].shape;
15307  if (unlikely(__pyx_t_8 < 0)) __pyx_t_7 = 0;
15308  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_7 = 0;
15309  if (__pyx_t_9 < 0) {
15310  __pyx_t_9 += __pyx_pybuffernd_dV.diminfo[1].shape;
15311  if (unlikely(__pyx_t_9 < 0)) __pyx_t_7 = 1;
15312  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_7 = 1;
15313  if (unlikely(__pyx_t_7 != -1)) {
15314  __Pyx_RaiseBufferIndexError(__pyx_t_7);
15315  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15316  }
15317  __pyx_t_10 = __pyx_v_eN;
15318  __pyx_t_11 = __pyx_v_k;
15319  __pyx_t_7 = -1;
15320  if (__pyx_t_10 < 0) {
15321  __pyx_t_10 += __pyx_pybuffernd_dm.diminfo[0].shape;
15322  if (unlikely(__pyx_t_10 < 0)) __pyx_t_7 = 0;
15323  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_dm.diminfo[0].shape)) __pyx_t_7 = 0;
15324  if (__pyx_t_11 < 0) {
15325  __pyx_t_11 += __pyx_pybuffernd_dm.diminfo[1].shape;
15326  if (unlikely(__pyx_t_11 < 0)) __pyx_t_7 = 1;
15327  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_dm.diminfo[1].shape)) __pyx_t_7 = 1;
15328  if (unlikely(__pyx_t_7 != -1)) {
15329  __Pyx_RaiseBufferIndexError(__pyx_t_7);
15330  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15331  }
15332  __pyx_v_omega_e = (__pyx_v_omega_e + ((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_dV.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dm.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_dm.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_dm.diminfo[1].strides))));
15333  }
15334 
15335  /* "subsurfaceTransportFunctions.pyx":771
15336  * vol_e += dV[eN,k]
15337  * omega_e += dV[eN,k]*dm[eN,k]
15338  * for j in range(l2g.shape[1]): # <<<<<<<<<<<<<<
15339  * J = l2g[eN,j]
15340  * characteristic_velocity_dofs[J] = df_dofs[J]*vol_e/(omega_e+1.0e-12)
15341  */
15342  __pyx_t_3 = (__pyx_v_l2g->dimensions[1]);
15343  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
15344  __pyx_v_j = __pyx_t_4;
15345 
15346  /* "subsurfaceTransportFunctions.pyx":772
15347  * omega_e += dV[eN,k]*dm[eN,k]
15348  * for j in range(l2g.shape[1]):
15349  * J = l2g[eN,j] # <<<<<<<<<<<<<<
15350  * characteristic_velocity_dofs[J] = df_dofs[J]*vol_e/(omega_e+1.0e-12)
15351  *
15352  */
15353  __pyx_t_12 = __pyx_v_eN;
15354  __pyx_t_13 = __pyx_v_j;
15355  __pyx_t_7 = -1;
15356  if (__pyx_t_12 < 0) {
15357  __pyx_t_12 += __pyx_pybuffernd_l2g.diminfo[0].shape;
15358  if (unlikely(__pyx_t_12 < 0)) __pyx_t_7 = 0;
15359  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_l2g.diminfo[0].shape)) __pyx_t_7 = 0;
15360  if (__pyx_t_13 < 0) {
15361  __pyx_t_13 += __pyx_pybuffernd_l2g.diminfo[1].shape;
15362  if (unlikely(__pyx_t_13 < 0)) __pyx_t_7 = 1;
15363  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_l2g.diminfo[1].shape)) __pyx_t_7 = 1;
15364  if (unlikely(__pyx_t_7 != -1)) {
15365  __Pyx_RaiseBufferIndexError(__pyx_t_7);
15366  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15367  }
15368  __pyx_v_J = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_l2g.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_l2g.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_l2g.diminfo[1].strides));
15369 
15370  /* "subsurfaceTransportFunctions.pyx":773
15371  * for j in range(l2g.shape[1]):
15372  * J = l2g[eN,j]
15373  * characteristic_velocity_dofs[J] = df_dofs[J]*vol_e/(omega_e+1.0e-12) # <<<<<<<<<<<<<<
15374  *
15375  * #problem specific velocity evaluation
15376  */
15377  __pyx_t_14 = __pyx_v_J;
15378  __pyx_t_7 = -1;
15379  if (__pyx_t_14 < 0) {
15380  __pyx_t_14 += __pyx_pybuffernd_df_dofs.diminfo[0].shape;
15381  if (unlikely(__pyx_t_14 < 0)) __pyx_t_7 = 0;
15382  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_df_dofs.diminfo[0].shape)) __pyx_t_7 = 0;
15383  if (unlikely(__pyx_t_7 != -1)) {
15384  __Pyx_RaiseBufferIndexError(__pyx_t_7);
15385  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15386  }
15387  __pyx_t_15 = ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_df_dofs.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_df_dofs.diminfo[0].strides)) * __pyx_v_vol_e);
15388  __pyx_t_16 = (__pyx_v_omega_e + 1.0e-12);
15389  if (unlikely(__pyx_t_16 == 0)) {
15390  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
15391  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15392  }
15393  __pyx_t_17 = __pyx_v_J;
15394  __pyx_t_7 = -1;
15395  if (__pyx_t_17 < 0) {
15396  __pyx_t_17 += __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].shape;
15397  if (unlikely(__pyx_t_17 < 0)) __pyx_t_7 = 0;
15398  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].shape)) __pyx_t_7 = 0;
15399  if (unlikely(__pyx_t_7 != -1)) {
15400  __Pyx_RaiseBufferIndexError(__pyx_t_7);
15401  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15402  }
15403  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].strides) = (__pyx_t_15 / __pyx_t_16);
15404  }
15405  }
15406 
15407  /* "subsurfaceTransportFunctions.pyx":753
15408  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
15409  *
15410  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs, # <<<<<<<<<<<<<<
15411  * numpy.ndarray[DTYPE_t,ndim=1] characteristic_velocity_dofs,
15412  * numpy.ndarray[ITYPE_t,ndim=2] l2g,
15413  */
15414 
15415  /* function exit code */
15416  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15417  goto __pyx_L0;
15418  __pyx_L1_error:;
15419  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
15420  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
15421  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer);
15422  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
15423  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_df_dofs.rcbuffer->pybuffer);
15424  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dm.rcbuffer->pybuffer);
15425  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_l2g.rcbuffer->pybuffer);
15426  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
15427  __Pyx_AddTraceback("subsurfaceTransportFunctions.computeSimpleCharacteristicVelocityFromVelocityDOFs", __pyx_clineno, __pyx_lineno, __pyx_filename);
15428  __pyx_r = NULL;
15429  goto __pyx_L2;
15430  __pyx_L0:;
15431  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer);
15432  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
15433  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_df_dofs.rcbuffer->pybuffer);
15434  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dm.rcbuffer->pybuffer);
15435  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_l2g.rcbuffer->pybuffer);
15436  __pyx_L2:;
15437  __Pyx_XGIVEREF(__pyx_r);
15438  __Pyx_RefNannyFinishContext();
15439  return __pyx_r;
15440 }
15441 
15442 /* "subsurfaceTransportFunctions.pyx":776
15443  *
15444  * #problem specific velocity evaluation
15445  * def rotatingGaussianElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
15446  * double t,
15447  * double tForReversal,
15448  */
15449 
15450 /* Python wrapper */
15451 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
15452 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3 = {"rotatingGaussianElementVelocityEval3", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3, METH_VARARGS|METH_KEYWORDS, 0};
15453 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
15454  int __pyx_v_transient;
15455  double __pyx_v_t;
15456  double __pyx_v_tForReversal;
15457  double __pyx_v_clock;
15458  double __pyx_v_xc;
15459  double __pyx_v_yc;
15460  PyArrayObject *__pyx_v_x = 0;
15461  PyArrayObject *__pyx_v_v = 0;
15462  double __pyx_v_zvelocity;
15463  int __pyx_lineno = 0;
15464  const char *__pyx_filename = NULL;
15465  int __pyx_clineno = 0;
15466  PyObject *__pyx_r = 0;
15467  __Pyx_RefNannyDeclarations
15468  __Pyx_RefNannySetupContext("rotatingGaussianElementVelocityEval3 (wrapper)", 0);
15469  {
15470  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_transient,&__pyx_n_s_t,&__pyx_n_s_tForReversal,&__pyx_n_s_clock,&__pyx_n_s_xc,&__pyx_n_s_yc,&__pyx_n_s_x,&__pyx_n_s_v,&__pyx_n_s_zvelocity,0};
15471  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
15472  if (unlikely(__pyx_kwds)) {
15473  Py_ssize_t kw_args;
15474  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
15475  switch (pos_args) {
15476  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
15477  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
15478  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
15479  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
15480  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
15481  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15482  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15483  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15484  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15485  case 0: break;
15486  default: goto __pyx_L5_argtuple_error;
15487  }
15488  kw_args = PyDict_Size(__pyx_kwds);
15489  switch (pos_args) {
15490  case 0:
15491  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_transient)) != 0)) kw_args--;
15492  else goto __pyx_L5_argtuple_error;
15493  case 1:
15494  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
15495  else {
15496  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
15497  }
15498  case 2:
15499  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tForReversal)) != 0)) kw_args--;
15500  else {
15501  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
15502  }
15503  case 3:
15504  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_clock)) != 0)) kw_args--;
15505  else {
15506  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
15507  }
15508  case 4:
15509  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_xc)) != 0)) kw_args--;
15510  else {
15511  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
15512  }
15513  case 5:
15514  if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_yc)) != 0)) kw_args--;
15515  else {
15516  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
15517  }
15518  case 6:
15519  if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
15520  else {
15521  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
15522  }
15523  case 7:
15524  if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
15525  else {
15526  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
15527  }
15528  case 8:
15529  if (kw_args > 0) {
15530  PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_zvelocity);
15531  if (value) { values[8] = value; kw_args--; }
15532  }
15533  }
15534  if (unlikely(kw_args > 0)) {
15535  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rotatingGaussianElementVelocityEval3") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
15536  }
15537  } else {
15538  switch (PyTuple_GET_SIZE(__pyx_args)) {
15539  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
15540  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
15541  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
15542  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
15543  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
15544  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15545  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15546  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15547  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15548  break;
15549  default: goto __pyx_L5_argtuple_error;
15550  }
15551  }
15552  __pyx_v_transient = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_transient == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
15553  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
15554  __pyx_v_tForReversal = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tForReversal == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
15555  __pyx_v_clock = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_clock == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
15556  __pyx_v_xc = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_xc == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
15557  __pyx_v_yc = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_yc == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
15558  __pyx_v_x = ((PyArrayObject *)values[6]);
15559  __pyx_v_v = ((PyArrayObject *)values[7]);
15560  if (values[8]) {
15561  __pyx_v_zvelocity = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_zvelocity == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
15562  } else {
15563  __pyx_v_zvelocity = ((double)0.0);
15564  }
15565  }
15566  goto __pyx_L4_argument_unpacking_done;
15567  __pyx_L5_argtuple_error:;
15568  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
15569  __pyx_L3_error:;
15570  __Pyx_AddTraceback("subsurfaceTransportFunctions.rotatingGaussianElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
15571  __Pyx_RefNannyFinishContext();
15572  return NULL;
15573  __pyx_L4_argument_unpacking_done:;
15574  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15575  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15576  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_46rotatingGaussianElementVelocityEval3(__pyx_self, __pyx_v_transient, __pyx_v_t, __pyx_v_tForReversal, __pyx_v_clock, __pyx_v_xc, __pyx_v_yc, __pyx_v_x, __pyx_v_v, __pyx_v_zvelocity);
15577 
15578  /* function exit code */
15579  goto __pyx_L0;
15580  __pyx_L1_error:;
15581  __pyx_r = NULL;
15582  __pyx_L0:;
15583  __Pyx_RefNannyFinishContext();
15584  return __pyx_r;
15585 }
15586 
15587 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_46rotatingGaussianElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v, double __pyx_v_zvelocity) {
15588  int __pyx_v_eN;
15589  int __pyx_v_k;
15590  double __pyx_v_pi;
15591  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
15592  __Pyx_Buffer __pyx_pybuffer_v;
15593  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
15594  __Pyx_Buffer __pyx_pybuffer_x;
15595  PyObject *__pyx_r = NULL;
15596  __Pyx_RefNannyDeclarations
15597  int __pyx_t_1;
15598  npy_intp __pyx_t_2;
15599  int __pyx_t_3;
15600  npy_intp __pyx_t_4;
15601  int __pyx_t_5;
15602  Py_ssize_t __pyx_t_6;
15603  Py_ssize_t __pyx_t_7;
15604  Py_ssize_t __pyx_t_8;
15605  int __pyx_t_9;
15606  Py_ssize_t __pyx_t_10;
15607  Py_ssize_t __pyx_t_11;
15608  Py_ssize_t __pyx_t_12;
15609  Py_ssize_t __pyx_t_13;
15610  Py_ssize_t __pyx_t_14;
15611  Py_ssize_t __pyx_t_15;
15612  Py_ssize_t __pyx_t_16;
15613  Py_ssize_t __pyx_t_17;
15614  Py_ssize_t __pyx_t_18;
15615  Py_ssize_t __pyx_t_19;
15616  Py_ssize_t __pyx_t_20;
15617  Py_ssize_t __pyx_t_21;
15618  PyObject *__pyx_t_22 = NULL;
15619  PyObject *__pyx_t_23 = NULL;
15620  PyObject *__pyx_t_24 = NULL;
15621  double __pyx_t_25;
15622  double __pyx_t_26;
15623  PyObject *__pyx_t_27 = NULL;
15624  Py_ssize_t __pyx_t_28;
15625  Py_ssize_t __pyx_t_29;
15626  Py_ssize_t __pyx_t_30;
15627  Py_ssize_t __pyx_t_31;
15628  Py_ssize_t __pyx_t_32;
15629  Py_ssize_t __pyx_t_33;
15630  Py_ssize_t __pyx_t_34;
15631  Py_ssize_t __pyx_t_35;
15632  Py_ssize_t __pyx_t_36;
15633  Py_ssize_t __pyx_t_37;
15634  Py_ssize_t __pyx_t_38;
15635  Py_ssize_t __pyx_t_39;
15636  Py_ssize_t __pyx_t_40;
15637  Py_ssize_t __pyx_t_41;
15638  Py_ssize_t __pyx_t_42;
15639  Py_ssize_t __pyx_t_43;
15640  Py_ssize_t __pyx_t_44;
15641  Py_ssize_t __pyx_t_45;
15642  Py_ssize_t __pyx_t_46;
15643  Py_ssize_t __pyx_t_47;
15644  Py_ssize_t __pyx_t_48;
15645  Py_ssize_t __pyx_t_49;
15646  Py_ssize_t __pyx_t_50;
15647  Py_ssize_t __pyx_t_51;
15648  Py_ssize_t __pyx_t_52;
15649  Py_ssize_t __pyx_t_53;
15650  Py_ssize_t __pyx_t_54;
15651  Py_ssize_t __pyx_t_55;
15652  Py_ssize_t __pyx_t_56;
15653  Py_ssize_t __pyx_t_57;
15654  Py_ssize_t __pyx_t_58;
15655  Py_ssize_t __pyx_t_59;
15656  Py_ssize_t __pyx_t_60;
15657  Py_ssize_t __pyx_t_61;
15658  Py_ssize_t __pyx_t_62;
15659  Py_ssize_t __pyx_t_63;
15660  Py_ssize_t __pyx_t_64;
15661  Py_ssize_t __pyx_t_65;
15662  Py_ssize_t __pyx_t_66;
15663  int __pyx_lineno = 0;
15664  const char *__pyx_filename = NULL;
15665  int __pyx_clineno = 0;
15666  __Pyx_RefNannySetupContext("rotatingGaussianElementVelocityEval3", 0);
15667  __pyx_pybuffer_x.pybuffer.buf = NULL;
15668  __pyx_pybuffer_x.refcount = 0;
15669  __pyx_pybuffernd_x.data = NULL;
15670  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
15671  __pyx_pybuffer_v.pybuffer.buf = NULL;
15672  __pyx_pybuffer_v.refcount = 0;
15673  __pyx_pybuffernd_v.data = NULL;
15674  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
15675  {
15676  __Pyx_BufFmt_StackElem __pyx_stack[1];
15677  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15678  }
15679  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
15680  {
15681  __Pyx_BufFmt_StackElem __pyx_stack[1];
15682  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15683  }
15684  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2];
15685 
15686  /* "subsurfaceTransportFunctions.pyx":786
15687  * cdef int eN,k
15688  * cdef double pi
15689  * pi = M_PI # <<<<<<<<<<<<<<
15690  * if v.shape[2] == 3:
15691  * if transient == 1:
15692  */
15693  __pyx_v_pi = M_PI;
15694 
15695  /* "subsurfaceTransportFunctions.pyx":787
15696  * cdef double pi
15697  * pi = M_PI
15698  * if v.shape[2] == 3: # <<<<<<<<<<<<<<
15699  * if transient == 1:
15700  * for eN in range(x.shape[0]):
15701  */
15702  __pyx_t_1 = (((__pyx_v_v->dimensions[2]) == 3) != 0);
15703  if (__pyx_t_1) {
15704 
15705  /* "subsurfaceTransportFunctions.pyx":788
15706  * pi = M_PI
15707  * if v.shape[2] == 3:
15708  * if transient == 1: # <<<<<<<<<<<<<<
15709  * for eN in range(x.shape[0]):
15710  * for k in range(x.shape[1]):
15711  */
15712  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
15713  if (__pyx_t_1) {
15714 
15715  /* "subsurfaceTransportFunctions.pyx":789
15716  * if v.shape[2] == 3:
15717  * if transient == 1:
15718  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
15719  * for k in range(x.shape[1]):
15720  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
15721  */
15722  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
15723  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
15724  __pyx_v_eN = __pyx_t_3;
15725 
15726  /* "subsurfaceTransportFunctions.pyx":790
15727  * if transient == 1:
15728  * for eN in range(x.shape[0]):
15729  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
15730  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
15731  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
15732  */
15733  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
15734  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
15735  __pyx_v_k = __pyx_t_5;
15736 
15737  /* "subsurfaceTransportFunctions.pyx":791
15738  * for eN in range(x.shape[0]):
15739  * for k in range(x.shape[1]):
15740  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
15741  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
15742  * v[eN,k,2]=zvelocity
15743  */
15744  __pyx_t_6 = __pyx_v_eN;
15745  __pyx_t_7 = __pyx_v_k;
15746  __pyx_t_8 = 1;
15747  __pyx_t_9 = -1;
15748  if (__pyx_t_6 < 0) {
15749  __pyx_t_6 += __pyx_pybuffernd_x.diminfo[0].shape;
15750  if (unlikely(__pyx_t_6 < 0)) __pyx_t_9 = 0;
15751  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_9 = 0;
15752  if (__pyx_t_7 < 0) {
15753  __pyx_t_7 += __pyx_pybuffernd_x.diminfo[1].shape;
15754  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 1;
15755  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_9 = 1;
15756  if (__pyx_t_8 < 0) {
15757  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[2].shape;
15758  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 2;
15759  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_9 = 2;
15760  if (unlikely(__pyx_t_9 != -1)) {
15761  __Pyx_RaiseBufferIndexError(__pyx_t_9);
15762  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15763  }
15764  __pyx_t_10 = __pyx_v_eN;
15765  __pyx_t_11 = __pyx_v_k;
15766  __pyx_t_12 = 0;
15767  __pyx_t_9 = -1;
15768  if (__pyx_t_10 < 0) {
15769  __pyx_t_10 += __pyx_pybuffernd_v.diminfo[0].shape;
15770  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
15771  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_9 = 0;
15772  if (__pyx_t_11 < 0) {
15773  __pyx_t_11 += __pyx_pybuffernd_v.diminfo[1].shape;
15774  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
15775  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_9 = 1;
15776  if (__pyx_t_12 < 0) {
15777  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[2].shape;
15778  if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 2;
15779  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_9 = 2;
15780  if (unlikely(__pyx_t_9 != -1)) {
15781  __Pyx_RaiseBufferIndexError(__pyx_t_9);
15782  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15783  }
15784  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_8, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
15785 
15786  /* "subsurfaceTransportFunctions.pyx":792
15787  * for k in range(x.shape[1]):
15788  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
15789  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
15790  * v[eN,k,2]=zvelocity
15791  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
15792  */
15793  __pyx_t_13 = __pyx_v_eN;
15794  __pyx_t_14 = __pyx_v_k;
15795  __pyx_t_15 = 0;
15796  __pyx_t_9 = -1;
15797  if (__pyx_t_13 < 0) {
15798  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[0].shape;
15799  if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 0;
15800  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_9 = 0;
15801  if (__pyx_t_14 < 0) {
15802  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[1].shape;
15803  if (unlikely(__pyx_t_14 < 0)) __pyx_t_9 = 1;
15804  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_9 = 1;
15805  if (__pyx_t_15 < 0) {
15806  __pyx_t_15 += __pyx_pybuffernd_x.diminfo[2].shape;
15807  if (unlikely(__pyx_t_15 < 0)) __pyx_t_9 = 2;
15808  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_9 = 2;
15809  if (unlikely(__pyx_t_9 != -1)) {
15810  __Pyx_RaiseBufferIndexError(__pyx_t_9);
15811  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15812  }
15813  __pyx_t_16 = __pyx_v_eN;
15814  __pyx_t_17 = __pyx_v_k;
15815  __pyx_t_18 = 1;
15816  __pyx_t_9 = -1;
15817  if (__pyx_t_16 < 0) {
15818  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[0].shape;
15819  if (unlikely(__pyx_t_16 < 0)) __pyx_t_9 = 0;
15820  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_9 = 0;
15821  if (__pyx_t_17 < 0) {
15822  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[1].shape;
15823  if (unlikely(__pyx_t_17 < 0)) __pyx_t_9 = 1;
15824  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_9 = 1;
15825  if (__pyx_t_18 < 0) {
15826  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[2].shape;
15827  if (unlikely(__pyx_t_18 < 0)) __pyx_t_9 = 2;
15828  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_9 = 2;
15829  if (unlikely(__pyx_t_9 != -1)) {
15830  __Pyx_RaiseBufferIndexError(__pyx_t_9);
15831  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15832  }
15833  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_15, __pyx_pybuffernd_x.diminfo[2].strides))));
15834 
15835  /* "subsurfaceTransportFunctions.pyx":793
15836  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
15837  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
15838  * v[eN,k,2]=zvelocity # <<<<<<<<<<<<<<
15839  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
15840  * else:
15841  */
15842  __pyx_t_19 = __pyx_v_eN;
15843  __pyx_t_20 = __pyx_v_k;
15844  __pyx_t_21 = 2;
15845  __pyx_t_9 = -1;
15846  if (__pyx_t_19 < 0) {
15847  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[0].shape;
15848  if (unlikely(__pyx_t_19 < 0)) __pyx_t_9 = 0;
15849  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_9 = 0;
15850  if (__pyx_t_20 < 0) {
15851  __pyx_t_20 += __pyx_pybuffernd_v.diminfo[1].shape;
15852  if (unlikely(__pyx_t_20 < 0)) __pyx_t_9 = 1;
15853  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_9 = 1;
15854  if (__pyx_t_21 < 0) {
15855  __pyx_t_21 += __pyx_pybuffernd_v.diminfo[2].shape;
15856  if (unlikely(__pyx_t_21 < 0)) __pyx_t_9 = 2;
15857  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_9 = 2;
15858  if (unlikely(__pyx_t_9 != -1)) {
15859  __Pyx_RaiseBufferIndexError(__pyx_t_9);
15860  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15861  }
15862  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_21, __pyx_pybuffernd_v.diminfo[2].strides) = __pyx_v_zvelocity;
15863 
15864  /* "subsurfaceTransportFunctions.pyx":794
15865  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
15866  * v[eN,k,2]=zvelocity
15867  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
15868  * else:
15869  * for eN in range(x.shape[0]):
15870  */
15871  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15872  __Pyx_GOTREF(__pyx_t_22);
15873  __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15874  __Pyx_GOTREF(__pyx_t_23);
15875  __pyx_t_24 = PyTuple_New(3); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15876  __Pyx_GOTREF(__pyx_t_24);
15877  __Pyx_GIVEREF(__pyx_t_22);
15878  PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_22);
15879  __Pyx_GIVEREF(__pyx_t_23);
15880  PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_t_23);
15881  __Pyx_INCREF(__pyx_slice__3);
15882  __Pyx_GIVEREF(__pyx_slice__3);
15883  PyTuple_SET_ITEM(__pyx_t_24, 2, __pyx_slice__3);
15884  __pyx_t_22 = 0;
15885  __pyx_t_23 = 0;
15886  __pyx_t_23 = PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_24); if (unlikely(__pyx_t_23 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
15887  __Pyx_GOTREF(__pyx_t_23);
15888  __pyx_t_25 = (__pyx_v_tForReversal - __pyx_v_t);
15889  __pyx_t_26 = (__pyx_v_tForReversal - 0.0);
15890  if (unlikely(__pyx_t_26 == 0)) {
15891  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
15892  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15893  }
15894  __pyx_t_22 = PyFloat_FromDouble(((__pyx_t_25 / __pyx_t_26) * __pyx_v_clock)); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15895  __Pyx_GOTREF(__pyx_t_22);
15896  __pyx_t_27 = PyNumber_InPlaceMultiply(__pyx_t_23, __pyx_t_22); if (unlikely(!__pyx_t_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15897  __Pyx_GOTREF(__pyx_t_27);
15898  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
15899  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
15900  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_24, __pyx_t_27) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15901  __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
15902  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
15903  }
15904  }
15905 
15906  /* "subsurfaceTransportFunctions.pyx":788
15907  * pi = M_PI
15908  * if v.shape[2] == 3:
15909  * if transient == 1: # <<<<<<<<<<<<<<
15910  * for eN in range(x.shape[0]):
15911  * for k in range(x.shape[1]):
15912  */
15913  goto __pyx_L4;
15914  }
15915 
15916  /* "subsurfaceTransportFunctions.pyx":796
15917  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
15918  * else:
15919  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
15920  * for k in range(x.shape[1]):
15921  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
15922  */
15923  /*else*/ {
15924  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
15925  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
15926  __pyx_v_eN = __pyx_t_3;
15927 
15928  /* "subsurfaceTransportFunctions.pyx":797
15929  * else:
15930  * for eN in range(x.shape[0]):
15931  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
15932  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
15933  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
15934  */
15935  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
15936  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
15937  __pyx_v_k = __pyx_t_5;
15938 
15939  /* "subsurfaceTransportFunctions.pyx":798
15940  * for eN in range(x.shape[0]):
15941  * for k in range(x.shape[1]):
15942  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
15943  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
15944  * v[eN,k,2]=zvelocity
15945  */
15946  __pyx_t_28 = __pyx_v_eN;
15947  __pyx_t_29 = __pyx_v_k;
15948  __pyx_t_30 = 1;
15949  __pyx_t_9 = -1;
15950  if (__pyx_t_28 < 0) {
15951  __pyx_t_28 += __pyx_pybuffernd_x.diminfo[0].shape;
15952  if (unlikely(__pyx_t_28 < 0)) __pyx_t_9 = 0;
15953  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_9 = 0;
15954  if (__pyx_t_29 < 0) {
15955  __pyx_t_29 += __pyx_pybuffernd_x.diminfo[1].shape;
15956  if (unlikely(__pyx_t_29 < 0)) __pyx_t_9 = 1;
15957  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_9 = 1;
15958  if (__pyx_t_30 < 0) {
15959  __pyx_t_30 += __pyx_pybuffernd_x.diminfo[2].shape;
15960  if (unlikely(__pyx_t_30 < 0)) __pyx_t_9 = 2;
15961  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_9 = 2;
15962  if (unlikely(__pyx_t_9 != -1)) {
15963  __Pyx_RaiseBufferIndexError(__pyx_t_9);
15964  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15965  }
15966  __pyx_t_31 = __pyx_v_eN;
15967  __pyx_t_32 = __pyx_v_k;
15968  __pyx_t_33 = 0;
15969  __pyx_t_9 = -1;
15970  if (__pyx_t_31 < 0) {
15971  __pyx_t_31 += __pyx_pybuffernd_v.diminfo[0].shape;
15972  if (unlikely(__pyx_t_31 < 0)) __pyx_t_9 = 0;
15973  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_9 = 0;
15974  if (__pyx_t_32 < 0) {
15975  __pyx_t_32 += __pyx_pybuffernd_v.diminfo[1].shape;
15976  if (unlikely(__pyx_t_32 < 0)) __pyx_t_9 = 1;
15977  } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_9 = 1;
15978  if (__pyx_t_33 < 0) {
15979  __pyx_t_33 += __pyx_pybuffernd_v.diminfo[2].shape;
15980  if (unlikely(__pyx_t_33 < 0)) __pyx_t_9 = 2;
15981  } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_9 = 2;
15982  if (unlikely(__pyx_t_9 != -1)) {
15983  __Pyx_RaiseBufferIndexError(__pyx_t_9);
15984  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15985  }
15986  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_33, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_30, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
15987 
15988  /* "subsurfaceTransportFunctions.pyx":799
15989  * for k in range(x.shape[1]):
15990  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
15991  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
15992  * v[eN,k,2]=zvelocity
15993  * else:
15994  */
15995  __pyx_t_34 = __pyx_v_eN;
15996  __pyx_t_35 = __pyx_v_k;
15997  __pyx_t_36 = 0;
15998  __pyx_t_9 = -1;
15999  if (__pyx_t_34 < 0) {
16000  __pyx_t_34 += __pyx_pybuffernd_x.diminfo[0].shape;
16001  if (unlikely(__pyx_t_34 < 0)) __pyx_t_9 = 0;
16002  } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_9 = 0;
16003  if (__pyx_t_35 < 0) {
16004  __pyx_t_35 += __pyx_pybuffernd_x.diminfo[1].shape;
16005  if (unlikely(__pyx_t_35 < 0)) __pyx_t_9 = 1;
16006  } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_9 = 1;
16007  if (__pyx_t_36 < 0) {
16008  __pyx_t_36 += __pyx_pybuffernd_x.diminfo[2].shape;
16009  if (unlikely(__pyx_t_36 < 0)) __pyx_t_9 = 2;
16010  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_9 = 2;
16011  if (unlikely(__pyx_t_9 != -1)) {
16012  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16013  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16014  }
16015  __pyx_t_37 = __pyx_v_eN;
16016  __pyx_t_38 = __pyx_v_k;
16017  __pyx_t_39 = 1;
16018  __pyx_t_9 = -1;
16019  if (__pyx_t_37 < 0) {
16020  __pyx_t_37 += __pyx_pybuffernd_v.diminfo[0].shape;
16021  if (unlikely(__pyx_t_37 < 0)) __pyx_t_9 = 0;
16022  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_9 = 0;
16023  if (__pyx_t_38 < 0) {
16024  __pyx_t_38 += __pyx_pybuffernd_v.diminfo[1].shape;
16025  if (unlikely(__pyx_t_38 < 0)) __pyx_t_9 = 1;
16026  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_9 = 1;
16027  if (__pyx_t_39 < 0) {
16028  __pyx_t_39 += __pyx_pybuffernd_v.diminfo[2].shape;
16029  if (unlikely(__pyx_t_39 < 0)) __pyx_t_9 = 2;
16030  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_9 = 2;
16031  if (unlikely(__pyx_t_9 != -1)) {
16032  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16033  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16034  }
16035  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_39, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_36, __pyx_pybuffernd_x.diminfo[2].strides))));
16036 
16037  /* "subsurfaceTransportFunctions.pyx":800
16038  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
16039  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
16040  * v[eN,k,2]=zvelocity # <<<<<<<<<<<<<<
16041  * else:
16042  * assert v.shape[2] == 2
16043  */
16044  __pyx_t_40 = __pyx_v_eN;
16045  __pyx_t_41 = __pyx_v_k;
16046  __pyx_t_42 = 2;
16047  __pyx_t_9 = -1;
16048  if (__pyx_t_40 < 0) {
16049  __pyx_t_40 += __pyx_pybuffernd_v.diminfo[0].shape;
16050  if (unlikely(__pyx_t_40 < 0)) __pyx_t_9 = 0;
16051  } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_9 = 0;
16052  if (__pyx_t_41 < 0) {
16053  __pyx_t_41 += __pyx_pybuffernd_v.diminfo[1].shape;
16054  if (unlikely(__pyx_t_41 < 0)) __pyx_t_9 = 1;
16055  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_9 = 1;
16056  if (__pyx_t_42 < 0) {
16057  __pyx_t_42 += __pyx_pybuffernd_v.diminfo[2].shape;
16058  if (unlikely(__pyx_t_42 < 0)) __pyx_t_9 = 2;
16059  } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_9 = 2;
16060  if (unlikely(__pyx_t_9 != -1)) {
16061  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16062  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16063  }
16064  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_41, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_42, __pyx_pybuffernd_v.diminfo[2].strides) = __pyx_v_zvelocity;
16065  }
16066  }
16067  }
16068  __pyx_L4:;
16069 
16070  /* "subsurfaceTransportFunctions.pyx":787
16071  * cdef double pi
16072  * pi = M_PI
16073  * if v.shape[2] == 3: # <<<<<<<<<<<<<<
16074  * if transient == 1:
16075  * for eN in range(x.shape[0]):
16076  */
16077  goto __pyx_L3;
16078  }
16079 
16080  /* "subsurfaceTransportFunctions.pyx":802
16081  * v[eN,k,2]=zvelocity
16082  * else:
16083  * assert v.shape[2] == 2 # <<<<<<<<<<<<<<
16084  * if transient == 1:
16085  * for eN in range(x.shape[0]):
16086  */
16087  /*else*/ {
16088  #ifndef CYTHON_WITHOUT_ASSERTIONS
16089  if (unlikely(!Py_OptimizeFlag)) {
16090  if (unlikely(!(((__pyx_v_v->dimensions[2]) == 2) != 0))) {
16091  PyErr_SetNone(PyExc_AssertionError);
16092  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16093  }
16094  }
16095  #endif
16096 
16097  /* "subsurfaceTransportFunctions.pyx":803
16098  * else:
16099  * assert v.shape[2] == 2
16100  * if transient == 1: # <<<<<<<<<<<<<<
16101  * for eN in range(x.shape[0]):
16102  * for k in range(x.shape[1]):
16103  */
16104  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
16105  if (__pyx_t_1) {
16106 
16107  /* "subsurfaceTransportFunctions.pyx":804
16108  * assert v.shape[2] == 2
16109  * if transient == 1:
16110  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
16111  * for k in range(x.shape[1]):
16112  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
16113  */
16114  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
16115  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
16116  __pyx_v_eN = __pyx_t_3;
16117 
16118  /* "subsurfaceTransportFunctions.pyx":805
16119  * if transient == 1:
16120  * for eN in range(x.shape[0]):
16121  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
16122  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
16123  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
16124  */
16125  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
16126  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
16127  __pyx_v_k = __pyx_t_5;
16128 
16129  /* "subsurfaceTransportFunctions.pyx":806
16130  * for eN in range(x.shape[0]):
16131  * for k in range(x.shape[1]):
16132  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
16133  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
16134  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
16135  */
16136  __pyx_t_43 = __pyx_v_eN;
16137  __pyx_t_44 = __pyx_v_k;
16138  __pyx_t_45 = 1;
16139  __pyx_t_9 = -1;
16140  if (__pyx_t_43 < 0) {
16141  __pyx_t_43 += __pyx_pybuffernd_x.diminfo[0].shape;
16142  if (unlikely(__pyx_t_43 < 0)) __pyx_t_9 = 0;
16143  } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_9 = 0;
16144  if (__pyx_t_44 < 0) {
16145  __pyx_t_44 += __pyx_pybuffernd_x.diminfo[1].shape;
16146  if (unlikely(__pyx_t_44 < 0)) __pyx_t_9 = 1;
16147  } else if (unlikely(__pyx_t_44 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_9 = 1;
16148  if (__pyx_t_45 < 0) {
16149  __pyx_t_45 += __pyx_pybuffernd_x.diminfo[2].shape;
16150  if (unlikely(__pyx_t_45 < 0)) __pyx_t_9 = 2;
16151  } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_9 = 2;
16152  if (unlikely(__pyx_t_9 != -1)) {
16153  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16154  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16155  }
16156  __pyx_t_46 = __pyx_v_eN;
16157  __pyx_t_47 = __pyx_v_k;
16158  __pyx_t_48 = 0;
16159  __pyx_t_9 = -1;
16160  if (__pyx_t_46 < 0) {
16161  __pyx_t_46 += __pyx_pybuffernd_v.diminfo[0].shape;
16162  if (unlikely(__pyx_t_46 < 0)) __pyx_t_9 = 0;
16163  } else if (unlikely(__pyx_t_46 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_9 = 0;
16164  if (__pyx_t_47 < 0) {
16165  __pyx_t_47 += __pyx_pybuffernd_v.diminfo[1].shape;
16166  if (unlikely(__pyx_t_47 < 0)) __pyx_t_9 = 1;
16167  } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_9 = 1;
16168  if (__pyx_t_48 < 0) {
16169  __pyx_t_48 += __pyx_pybuffernd_v.diminfo[2].shape;
16170  if (unlikely(__pyx_t_48 < 0)) __pyx_t_9 = 2;
16171  } else if (unlikely(__pyx_t_48 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_9 = 2;
16172  if (unlikely(__pyx_t_9 != -1)) {
16173  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16174  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16175  }
16176  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_47, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_48, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_44, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_45, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
16177 
16178  /* "subsurfaceTransportFunctions.pyx":807
16179  * for k in range(x.shape[1]):
16180  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
16181  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
16182  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
16183  * else:
16184  */
16185  __pyx_t_49 = __pyx_v_eN;
16186  __pyx_t_50 = __pyx_v_k;
16187  __pyx_t_51 = 0;
16188  __pyx_t_9 = -1;
16189  if (__pyx_t_49 < 0) {
16190  __pyx_t_49 += __pyx_pybuffernd_x.diminfo[0].shape;
16191  if (unlikely(__pyx_t_49 < 0)) __pyx_t_9 = 0;
16192  } else if (unlikely(__pyx_t_49 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_9 = 0;
16193  if (__pyx_t_50 < 0) {
16194  __pyx_t_50 += __pyx_pybuffernd_x.diminfo[1].shape;
16195  if (unlikely(__pyx_t_50 < 0)) __pyx_t_9 = 1;
16196  } else if (unlikely(__pyx_t_50 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_9 = 1;
16197  if (__pyx_t_51 < 0) {
16198  __pyx_t_51 += __pyx_pybuffernd_x.diminfo[2].shape;
16199  if (unlikely(__pyx_t_51 < 0)) __pyx_t_9 = 2;
16200  } else if (unlikely(__pyx_t_51 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_9 = 2;
16201  if (unlikely(__pyx_t_9 != -1)) {
16202  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16203  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16204  }
16205  __pyx_t_52 = __pyx_v_eN;
16206  __pyx_t_53 = __pyx_v_k;
16207  __pyx_t_54 = 1;
16208  __pyx_t_9 = -1;
16209  if (__pyx_t_52 < 0) {
16210  __pyx_t_52 += __pyx_pybuffernd_v.diminfo[0].shape;
16211  if (unlikely(__pyx_t_52 < 0)) __pyx_t_9 = 0;
16212  } else if (unlikely(__pyx_t_52 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_9 = 0;
16213  if (__pyx_t_53 < 0) {
16214  __pyx_t_53 += __pyx_pybuffernd_v.diminfo[1].shape;
16215  if (unlikely(__pyx_t_53 < 0)) __pyx_t_9 = 1;
16216  } else if (unlikely(__pyx_t_53 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_9 = 1;
16217  if (__pyx_t_54 < 0) {
16218  __pyx_t_54 += __pyx_pybuffernd_v.diminfo[2].shape;
16219  if (unlikely(__pyx_t_54 < 0)) __pyx_t_9 = 2;
16220  } else if (unlikely(__pyx_t_54 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_9 = 2;
16221  if (unlikely(__pyx_t_9 != -1)) {
16222  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16223  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16224  }
16225  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_52, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_53, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_54, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_50, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_51, __pyx_pybuffernd_x.diminfo[2].strides))));
16226 
16227  /* "subsurfaceTransportFunctions.pyx":808
16228  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
16229  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
16230  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
16231  * else:
16232  * for eN in range(x.shape[0]):
16233  */
16234  __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16235  __Pyx_GOTREF(__pyx_t_24);
16236  __pyx_t_27 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16237  __Pyx_GOTREF(__pyx_t_27);
16238  __pyx_t_22 = PyTuple_New(3); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16239  __Pyx_GOTREF(__pyx_t_22);
16240  __Pyx_GIVEREF(__pyx_t_24);
16241  PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_24);
16242  __Pyx_GIVEREF(__pyx_t_27);
16243  PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_27);
16244  __Pyx_INCREF(__pyx_slice__4);
16245  __Pyx_GIVEREF(__pyx_slice__4);
16246  PyTuple_SET_ITEM(__pyx_t_22, 2, __pyx_slice__4);
16247  __pyx_t_24 = 0;
16248  __pyx_t_27 = 0;
16249  __pyx_t_27 = PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_22); if (unlikely(__pyx_t_27 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
16250  __Pyx_GOTREF(__pyx_t_27);
16251  __pyx_t_26 = (__pyx_v_tForReversal - __pyx_v_t);
16252  __pyx_t_25 = (__pyx_v_tForReversal - 0.0);
16253  if (unlikely(__pyx_t_25 == 0)) {
16254  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
16255  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16256  }
16257  __pyx_t_24 = PyFloat_FromDouble(((__pyx_t_26 / __pyx_t_25) * __pyx_v_clock)); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16258  __Pyx_GOTREF(__pyx_t_24);
16259  __pyx_t_23 = PyNumber_InPlaceMultiply(__pyx_t_27, __pyx_t_24); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16260  __Pyx_GOTREF(__pyx_t_23);
16261  __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
16262  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
16263  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_22, __pyx_t_23) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16264  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
16265  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
16266  }
16267  }
16268 
16269  /* "subsurfaceTransportFunctions.pyx":803
16270  * else:
16271  * assert v.shape[2] == 2
16272  * if transient == 1: # <<<<<<<<<<<<<<
16273  * for eN in range(x.shape[0]):
16274  * for k in range(x.shape[1]):
16275  */
16276  goto __pyx_L13;
16277  }
16278 
16279  /* "subsurfaceTransportFunctions.pyx":810
16280  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
16281  * else:
16282  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
16283  * for k in range(x.shape[1]):
16284  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
16285  */
16286  /*else*/ {
16287  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
16288  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
16289  __pyx_v_eN = __pyx_t_3;
16290 
16291  /* "subsurfaceTransportFunctions.pyx":811
16292  * else:
16293  * for eN in range(x.shape[0]):
16294  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
16295  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
16296  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
16297  */
16298  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
16299  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
16300  __pyx_v_k = __pyx_t_5;
16301 
16302  /* "subsurfaceTransportFunctions.pyx":812
16303  * for eN in range(x.shape[0]):
16304  * for k in range(x.shape[1]):
16305  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
16306  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
16307  *
16308  */
16309  __pyx_t_55 = __pyx_v_eN;
16310  __pyx_t_56 = __pyx_v_k;
16311  __pyx_t_57 = 1;
16312  __pyx_t_9 = -1;
16313  if (__pyx_t_55 < 0) {
16314  __pyx_t_55 += __pyx_pybuffernd_x.diminfo[0].shape;
16315  if (unlikely(__pyx_t_55 < 0)) __pyx_t_9 = 0;
16316  } else if (unlikely(__pyx_t_55 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_9 = 0;
16317  if (__pyx_t_56 < 0) {
16318  __pyx_t_56 += __pyx_pybuffernd_x.diminfo[1].shape;
16319  if (unlikely(__pyx_t_56 < 0)) __pyx_t_9 = 1;
16320  } else if (unlikely(__pyx_t_56 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_9 = 1;
16321  if (__pyx_t_57 < 0) {
16322  __pyx_t_57 += __pyx_pybuffernd_x.diminfo[2].shape;
16323  if (unlikely(__pyx_t_57 < 0)) __pyx_t_9 = 2;
16324  } else if (unlikely(__pyx_t_57 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_9 = 2;
16325  if (unlikely(__pyx_t_9 != -1)) {
16326  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16327  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16328  }
16329  __pyx_t_58 = __pyx_v_eN;
16330  __pyx_t_59 = __pyx_v_k;
16331  __pyx_t_60 = 0;
16332  __pyx_t_9 = -1;
16333  if (__pyx_t_58 < 0) {
16334  __pyx_t_58 += __pyx_pybuffernd_v.diminfo[0].shape;
16335  if (unlikely(__pyx_t_58 < 0)) __pyx_t_9 = 0;
16336  } else if (unlikely(__pyx_t_58 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_9 = 0;
16337  if (__pyx_t_59 < 0) {
16338  __pyx_t_59 += __pyx_pybuffernd_v.diminfo[1].shape;
16339  if (unlikely(__pyx_t_59 < 0)) __pyx_t_9 = 1;
16340  } else if (unlikely(__pyx_t_59 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_9 = 1;
16341  if (__pyx_t_60 < 0) {
16342  __pyx_t_60 += __pyx_pybuffernd_v.diminfo[2].shape;
16343  if (unlikely(__pyx_t_60 < 0)) __pyx_t_9 = 2;
16344  } else if (unlikely(__pyx_t_60 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_9 = 2;
16345  if (unlikely(__pyx_t_9 != -1)) {
16346  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16347  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16348  }
16349  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_58, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_59, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_60, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_55, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_56, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_57, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
16350 
16351  /* "subsurfaceTransportFunctions.pyx":813
16352  * for k in range(x.shape[1]):
16353  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
16354  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
16355  *
16356  *
16357  */
16358  __pyx_t_61 = __pyx_v_eN;
16359  __pyx_t_62 = __pyx_v_k;
16360  __pyx_t_63 = 0;
16361  __pyx_t_9 = -1;
16362  if (__pyx_t_61 < 0) {
16363  __pyx_t_61 += __pyx_pybuffernd_x.diminfo[0].shape;
16364  if (unlikely(__pyx_t_61 < 0)) __pyx_t_9 = 0;
16365  } else if (unlikely(__pyx_t_61 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_9 = 0;
16366  if (__pyx_t_62 < 0) {
16367  __pyx_t_62 += __pyx_pybuffernd_x.diminfo[1].shape;
16368  if (unlikely(__pyx_t_62 < 0)) __pyx_t_9 = 1;
16369  } else if (unlikely(__pyx_t_62 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_9 = 1;
16370  if (__pyx_t_63 < 0) {
16371  __pyx_t_63 += __pyx_pybuffernd_x.diminfo[2].shape;
16372  if (unlikely(__pyx_t_63 < 0)) __pyx_t_9 = 2;
16373  } else if (unlikely(__pyx_t_63 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_9 = 2;
16374  if (unlikely(__pyx_t_9 != -1)) {
16375  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16376  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16377  }
16378  __pyx_t_64 = __pyx_v_eN;
16379  __pyx_t_65 = __pyx_v_k;
16380  __pyx_t_66 = 1;
16381  __pyx_t_9 = -1;
16382  if (__pyx_t_64 < 0) {
16383  __pyx_t_64 += __pyx_pybuffernd_v.diminfo[0].shape;
16384  if (unlikely(__pyx_t_64 < 0)) __pyx_t_9 = 0;
16385  } else if (unlikely(__pyx_t_64 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_9 = 0;
16386  if (__pyx_t_65 < 0) {
16387  __pyx_t_65 += __pyx_pybuffernd_v.diminfo[1].shape;
16388  if (unlikely(__pyx_t_65 < 0)) __pyx_t_9 = 1;
16389  } else if (unlikely(__pyx_t_65 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_9 = 1;
16390  if (__pyx_t_66 < 0) {
16391  __pyx_t_66 += __pyx_pybuffernd_v.diminfo[2].shape;
16392  if (unlikely(__pyx_t_66 < 0)) __pyx_t_9 = 2;
16393  } else if (unlikely(__pyx_t_66 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_9 = 2;
16394  if (unlikely(__pyx_t_9 != -1)) {
16395  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16396  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16397  }
16398  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_64, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_65, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_66, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_61, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_62, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_63, __pyx_pybuffernd_x.diminfo[2].strides))));
16399  }
16400  }
16401  }
16402  __pyx_L13:;
16403  }
16404  __pyx_L3:;
16405 
16406  /* "subsurfaceTransportFunctions.pyx":776
16407  *
16408  * #problem specific velocity evaluation
16409  * def rotatingGaussianElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
16410  * double t,
16411  * double tForReversal,
16412  */
16413 
16414  /* function exit code */
16415  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16416  goto __pyx_L0;
16417  __pyx_L1_error:;
16418  __Pyx_XDECREF(__pyx_t_22);
16419  __Pyx_XDECREF(__pyx_t_23);
16420  __Pyx_XDECREF(__pyx_t_24);
16421  __Pyx_XDECREF(__pyx_t_27);
16422  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
16423  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
16424  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
16425  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
16426  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
16427  __Pyx_AddTraceback("subsurfaceTransportFunctions.rotatingGaussianElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
16428  __pyx_r = NULL;
16429  goto __pyx_L2;
16430  __pyx_L0:;
16431  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
16432  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
16433  __pyx_L2:;
16434  __Pyx_XGIVEREF(__pyx_r);
16435  __Pyx_RefNannyFinishContext();
16436  return __pyx_r;
16437 }
16438 
16439 /* "subsurfaceTransportFunctions.pyx":816
16440  *
16441  *
16442  * def rotatingGaussianElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
16443  * double t,
16444  * double tForReversal,
16445  */
16446 
16447 /* Python wrapper */
16448 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
16449 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4 = {"rotatingGaussianElementVelocityEval4", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4, METH_VARARGS|METH_KEYWORDS, 0};
16450 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
16451  int __pyx_v_transient;
16452  double __pyx_v_t;
16453  double __pyx_v_tForReversal;
16454  double __pyx_v_clock;
16455  double __pyx_v_xc;
16456  double __pyx_v_yc;
16457  PyArrayObject *__pyx_v_x = 0;
16458  PyArrayObject *__pyx_v_v = 0;
16459  double __pyx_v_zvelocity;
16460  int __pyx_lineno = 0;
16461  const char *__pyx_filename = NULL;
16462  int __pyx_clineno = 0;
16463  PyObject *__pyx_r = 0;
16464  __Pyx_RefNannyDeclarations
16465  __Pyx_RefNannySetupContext("rotatingGaussianElementVelocityEval4 (wrapper)", 0);
16466  {
16467  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_transient,&__pyx_n_s_t,&__pyx_n_s_tForReversal,&__pyx_n_s_clock,&__pyx_n_s_xc,&__pyx_n_s_yc,&__pyx_n_s_x,&__pyx_n_s_v,&__pyx_n_s_zvelocity,0};
16468  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
16469  if (unlikely(__pyx_kwds)) {
16470  Py_ssize_t kw_args;
16471  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
16472  switch (pos_args) {
16473  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
16474  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
16475  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
16476  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
16477  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
16478  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16479  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16480  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16481  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16482  case 0: break;
16483  default: goto __pyx_L5_argtuple_error;
16484  }
16485  kw_args = PyDict_Size(__pyx_kwds);
16486  switch (pos_args) {
16487  case 0:
16488  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_transient)) != 0)) kw_args--;
16489  else goto __pyx_L5_argtuple_error;
16490  case 1:
16491  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
16492  else {
16493  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
16494  }
16495  case 2:
16496  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tForReversal)) != 0)) kw_args--;
16497  else {
16498  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
16499  }
16500  case 3:
16501  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_clock)) != 0)) kw_args--;
16502  else {
16503  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
16504  }
16505  case 4:
16506  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_xc)) != 0)) kw_args--;
16507  else {
16508  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
16509  }
16510  case 5:
16511  if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_yc)) != 0)) kw_args--;
16512  else {
16513  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
16514  }
16515  case 6:
16516  if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
16517  else {
16518  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
16519  }
16520  case 7:
16521  if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
16522  else {
16523  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
16524  }
16525  case 8:
16526  if (kw_args > 0) {
16527  PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_zvelocity);
16528  if (value) { values[8] = value; kw_args--; }
16529  }
16530  }
16531  if (unlikely(kw_args > 0)) {
16532  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rotatingGaussianElementVelocityEval4") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
16533  }
16534  } else {
16535  switch (PyTuple_GET_SIZE(__pyx_args)) {
16536  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
16537  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
16538  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
16539  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
16540  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
16541  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16542  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16543  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16544  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16545  break;
16546  default: goto __pyx_L5_argtuple_error;
16547  }
16548  }
16549  __pyx_v_transient = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_transient == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
16550  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
16551  __pyx_v_tForReversal = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tForReversal == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
16552  __pyx_v_clock = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_clock == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
16553  __pyx_v_xc = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_xc == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
16554  __pyx_v_yc = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_yc == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
16555  __pyx_v_x = ((PyArrayObject *)values[6]);
16556  __pyx_v_v = ((PyArrayObject *)values[7]);
16557  if (values[8]) {
16558  __pyx_v_zvelocity = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_zvelocity == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
16559  } else {
16560  __pyx_v_zvelocity = ((double)0.0);
16561  }
16562  }
16563  goto __pyx_L4_argument_unpacking_done;
16564  __pyx_L5_argtuple_error:;
16565  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
16566  __pyx_L3_error:;
16567  __Pyx_AddTraceback("subsurfaceTransportFunctions.rotatingGaussianElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
16568  __Pyx_RefNannyFinishContext();
16569  return NULL;
16570  __pyx_L4_argument_unpacking_done:;
16571  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16572  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16573  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_48rotatingGaussianElementVelocityEval4(__pyx_self, __pyx_v_transient, __pyx_v_t, __pyx_v_tForReversal, __pyx_v_clock, __pyx_v_xc, __pyx_v_yc, __pyx_v_x, __pyx_v_v, __pyx_v_zvelocity);
16574 
16575  /* function exit code */
16576  goto __pyx_L0;
16577  __pyx_L1_error:;
16578  __pyx_r = NULL;
16579  __pyx_L0:;
16580  __Pyx_RefNannyFinishContext();
16581  return __pyx_r;
16582 }
16583 
16584 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_48rotatingGaussianElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v, double __pyx_v_zvelocity) {
16585  int __pyx_v_eN;
16586  int __pyx_v_ebN;
16587  int __pyx_v_k;
16588  double __pyx_v_pi;
16589  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
16590  __Pyx_Buffer __pyx_pybuffer_v;
16591  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
16592  __Pyx_Buffer __pyx_pybuffer_x;
16593  PyObject *__pyx_r = NULL;
16594  __Pyx_RefNannyDeclarations
16595  int __pyx_t_1;
16596  npy_intp __pyx_t_2;
16597  int __pyx_t_3;
16598  npy_intp __pyx_t_4;
16599  int __pyx_t_5;
16600  npy_intp __pyx_t_6;
16601  int __pyx_t_7;
16602  Py_ssize_t __pyx_t_8;
16603  Py_ssize_t __pyx_t_9;
16604  Py_ssize_t __pyx_t_10;
16605  Py_ssize_t __pyx_t_11;
16606  int __pyx_t_12;
16607  Py_ssize_t __pyx_t_13;
16608  Py_ssize_t __pyx_t_14;
16609  Py_ssize_t __pyx_t_15;
16610  Py_ssize_t __pyx_t_16;
16611  Py_ssize_t __pyx_t_17;
16612  Py_ssize_t __pyx_t_18;
16613  Py_ssize_t __pyx_t_19;
16614  Py_ssize_t __pyx_t_20;
16615  Py_ssize_t __pyx_t_21;
16616  Py_ssize_t __pyx_t_22;
16617  Py_ssize_t __pyx_t_23;
16618  Py_ssize_t __pyx_t_24;
16619  Py_ssize_t __pyx_t_25;
16620  Py_ssize_t __pyx_t_26;
16621  Py_ssize_t __pyx_t_27;
16622  Py_ssize_t __pyx_t_28;
16623  PyObject *__pyx_t_29 = NULL;
16624  PyObject *__pyx_t_30 = NULL;
16625  PyObject *__pyx_t_31 = NULL;
16626  PyObject *__pyx_t_32 = NULL;
16627  double __pyx_t_33;
16628  double __pyx_t_34;
16629  Py_ssize_t __pyx_t_35;
16630  Py_ssize_t __pyx_t_36;
16631  Py_ssize_t __pyx_t_37;
16632  Py_ssize_t __pyx_t_38;
16633  Py_ssize_t __pyx_t_39;
16634  Py_ssize_t __pyx_t_40;
16635  Py_ssize_t __pyx_t_41;
16636  Py_ssize_t __pyx_t_42;
16637  Py_ssize_t __pyx_t_43;
16638  Py_ssize_t __pyx_t_44;
16639  Py_ssize_t __pyx_t_45;
16640  Py_ssize_t __pyx_t_46;
16641  Py_ssize_t __pyx_t_47;
16642  Py_ssize_t __pyx_t_48;
16643  Py_ssize_t __pyx_t_49;
16644  Py_ssize_t __pyx_t_50;
16645  Py_ssize_t __pyx_t_51;
16646  Py_ssize_t __pyx_t_52;
16647  Py_ssize_t __pyx_t_53;
16648  Py_ssize_t __pyx_t_54;
16649  Py_ssize_t __pyx_t_55;
16650  Py_ssize_t __pyx_t_56;
16651  Py_ssize_t __pyx_t_57;
16652  Py_ssize_t __pyx_t_58;
16653  Py_ssize_t __pyx_t_59;
16654  Py_ssize_t __pyx_t_60;
16655  Py_ssize_t __pyx_t_61;
16656  Py_ssize_t __pyx_t_62;
16657  Py_ssize_t __pyx_t_63;
16658  Py_ssize_t __pyx_t_64;
16659  Py_ssize_t __pyx_t_65;
16660  Py_ssize_t __pyx_t_66;
16661  Py_ssize_t __pyx_t_67;
16662  Py_ssize_t __pyx_t_68;
16663  Py_ssize_t __pyx_t_69;
16664  Py_ssize_t __pyx_t_70;
16665  Py_ssize_t __pyx_t_71;
16666  Py_ssize_t __pyx_t_72;
16667  Py_ssize_t __pyx_t_73;
16668  Py_ssize_t __pyx_t_74;
16669  Py_ssize_t __pyx_t_75;
16670  Py_ssize_t __pyx_t_76;
16671  Py_ssize_t __pyx_t_77;
16672  Py_ssize_t __pyx_t_78;
16673  Py_ssize_t __pyx_t_79;
16674  Py_ssize_t __pyx_t_80;
16675  Py_ssize_t __pyx_t_81;
16676  Py_ssize_t __pyx_t_82;
16677  Py_ssize_t __pyx_t_83;
16678  Py_ssize_t __pyx_t_84;
16679  Py_ssize_t __pyx_t_85;
16680  Py_ssize_t __pyx_t_86;
16681  int __pyx_lineno = 0;
16682  const char *__pyx_filename = NULL;
16683  int __pyx_clineno = 0;
16684  __Pyx_RefNannySetupContext("rotatingGaussianElementVelocityEval4", 0);
16685  __pyx_pybuffer_x.pybuffer.buf = NULL;
16686  __pyx_pybuffer_x.refcount = 0;
16687  __pyx_pybuffernd_x.data = NULL;
16688  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
16689  __pyx_pybuffer_v.pybuffer.buf = NULL;
16690  __pyx_pybuffer_v.refcount = 0;
16691  __pyx_pybuffernd_v.data = NULL;
16692  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
16693  {
16694  __Pyx_BufFmt_StackElem __pyx_stack[1];
16695  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16696  }
16697  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
16698  {
16699  __Pyx_BufFmt_StackElem __pyx_stack[1];
16700  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16701  }
16702  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_v.diminfo[3].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_v.diminfo[3].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[3];
16703 
16704  /* "subsurfaceTransportFunctions.pyx":826
16705  * cdef int eN,ebN,k
16706  * cdef double pi
16707  * pi = M_PI # <<<<<<<<<<<<<<
16708  * if v.shape[-1] == 3:
16709  * if transient == 1:
16710  */
16711  __pyx_v_pi = M_PI;
16712 
16713  /* "subsurfaceTransportFunctions.pyx":827
16714  * cdef double pi
16715  * pi = M_PI
16716  * if v.shape[-1] == 3: # <<<<<<<<<<<<<<
16717  * if transient == 1:
16718  * for eN in range(x.shape[0]):
16719  */
16720  __pyx_t_1 = (((__pyx_v_v->dimensions[-1L]) == 3) != 0);
16721  if (__pyx_t_1) {
16722 
16723  /* "subsurfaceTransportFunctions.pyx":828
16724  * pi = M_PI
16725  * if v.shape[-1] == 3:
16726  * if transient == 1: # <<<<<<<<<<<<<<
16727  * for eN in range(x.shape[0]):
16728  * for ebN in range(x.shape[1]):
16729  */
16730  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
16731  if (__pyx_t_1) {
16732 
16733  /* "subsurfaceTransportFunctions.pyx":829
16734  * if v.shape[-1] == 3:
16735  * if transient == 1:
16736  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
16737  * for ebN in range(x.shape[1]):
16738  * for k in range(x.shape[2]):
16739  */
16740  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
16741  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
16742  __pyx_v_eN = __pyx_t_3;
16743 
16744  /* "subsurfaceTransportFunctions.pyx":830
16745  * if transient == 1:
16746  * for eN in range(x.shape[0]):
16747  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
16748  * for k in range(x.shape[2]):
16749  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
16750  */
16751  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
16752  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
16753  __pyx_v_ebN = __pyx_t_5;
16754 
16755  /* "subsurfaceTransportFunctions.pyx":831
16756  * for eN in range(x.shape[0]):
16757  * for ebN in range(x.shape[1]):
16758  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
16759  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
16760  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
16761  */
16762  __pyx_t_6 = (__pyx_v_x->dimensions[2]);
16763  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
16764  __pyx_v_k = __pyx_t_7;
16765 
16766  /* "subsurfaceTransportFunctions.pyx":832
16767  * for ebN in range(x.shape[1]):
16768  * for k in range(x.shape[2]):
16769  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
16770  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
16771  * v[eN,ebN,k,2]=zvelocity
16772  */
16773  __pyx_t_8 = __pyx_v_eN;
16774  __pyx_t_9 = __pyx_v_ebN;
16775  __pyx_t_10 = __pyx_v_k;
16776  __pyx_t_11 = 1;
16777  __pyx_t_12 = -1;
16778  if (__pyx_t_8 < 0) {
16779  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[0].shape;
16780  if (unlikely(__pyx_t_8 < 0)) __pyx_t_12 = 0;
16781  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_12 = 0;
16782  if (__pyx_t_9 < 0) {
16783  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
16784  if (unlikely(__pyx_t_9 < 0)) __pyx_t_12 = 1;
16785  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_12 = 1;
16786  if (__pyx_t_10 < 0) {
16787  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[2].shape;
16788  if (unlikely(__pyx_t_10 < 0)) __pyx_t_12 = 2;
16789  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_12 = 2;
16790  if (__pyx_t_11 < 0) {
16791  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[3].shape;
16792  if (unlikely(__pyx_t_11 < 0)) __pyx_t_12 = 3;
16793  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_12 = 3;
16794  if (unlikely(__pyx_t_12 != -1)) {
16795  __Pyx_RaiseBufferIndexError(__pyx_t_12);
16796  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16797  }
16798  __pyx_t_13 = __pyx_v_eN;
16799  __pyx_t_14 = __pyx_v_ebN;
16800  __pyx_t_15 = __pyx_v_k;
16801  __pyx_t_16 = 0;
16802  __pyx_t_12 = -1;
16803  if (__pyx_t_13 < 0) {
16804  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[0].shape;
16805  if (unlikely(__pyx_t_13 < 0)) __pyx_t_12 = 0;
16806  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_12 = 0;
16807  if (__pyx_t_14 < 0) {
16808  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[1].shape;
16809  if (unlikely(__pyx_t_14 < 0)) __pyx_t_12 = 1;
16810  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_12 = 1;
16811  if (__pyx_t_15 < 0) {
16812  __pyx_t_15 += __pyx_pybuffernd_v.diminfo[2].shape;
16813  if (unlikely(__pyx_t_15 < 0)) __pyx_t_12 = 2;
16814  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_12 = 2;
16815  if (__pyx_t_16 < 0) {
16816  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[3].shape;
16817  if (unlikely(__pyx_t_16 < 0)) __pyx_t_12 = 3;
16818  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_12 = 3;
16819  if (unlikely(__pyx_t_12 != -1)) {
16820  __Pyx_RaiseBufferIndexError(__pyx_t_12);
16821  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16822  }
16823  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_15, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_16, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
16824 
16825  /* "subsurfaceTransportFunctions.pyx":833
16826  * for k in range(x.shape[2]):
16827  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
16828  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
16829  * v[eN,ebN,k,2]=zvelocity
16830  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
16831  */
16832  __pyx_t_17 = __pyx_v_eN;
16833  __pyx_t_18 = __pyx_v_ebN;
16834  __pyx_t_19 = __pyx_v_k;
16835  __pyx_t_20 = 0;
16836  __pyx_t_12 = -1;
16837  if (__pyx_t_17 < 0) {
16838  __pyx_t_17 += __pyx_pybuffernd_x.diminfo[0].shape;
16839  if (unlikely(__pyx_t_17 < 0)) __pyx_t_12 = 0;
16840  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_12 = 0;
16841  if (__pyx_t_18 < 0) {
16842  __pyx_t_18 += __pyx_pybuffernd_x.diminfo[1].shape;
16843  if (unlikely(__pyx_t_18 < 0)) __pyx_t_12 = 1;
16844  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_12 = 1;
16845  if (__pyx_t_19 < 0) {
16846  __pyx_t_19 += __pyx_pybuffernd_x.diminfo[2].shape;
16847  if (unlikely(__pyx_t_19 < 0)) __pyx_t_12 = 2;
16848  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_12 = 2;
16849  if (__pyx_t_20 < 0) {
16850  __pyx_t_20 += __pyx_pybuffernd_x.diminfo[3].shape;
16851  if (unlikely(__pyx_t_20 < 0)) __pyx_t_12 = 3;
16852  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_12 = 3;
16853  if (unlikely(__pyx_t_12 != -1)) {
16854  __Pyx_RaiseBufferIndexError(__pyx_t_12);
16855  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16856  }
16857  __pyx_t_21 = __pyx_v_eN;
16858  __pyx_t_22 = __pyx_v_ebN;
16859  __pyx_t_23 = __pyx_v_k;
16860  __pyx_t_24 = 1;
16861  __pyx_t_12 = -1;
16862  if (__pyx_t_21 < 0) {
16863  __pyx_t_21 += __pyx_pybuffernd_v.diminfo[0].shape;
16864  if (unlikely(__pyx_t_21 < 0)) __pyx_t_12 = 0;
16865  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_12 = 0;
16866  if (__pyx_t_22 < 0) {
16867  __pyx_t_22 += __pyx_pybuffernd_v.diminfo[1].shape;
16868  if (unlikely(__pyx_t_22 < 0)) __pyx_t_12 = 1;
16869  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_12 = 1;
16870  if (__pyx_t_23 < 0) {
16871  __pyx_t_23 += __pyx_pybuffernd_v.diminfo[2].shape;
16872  if (unlikely(__pyx_t_23 < 0)) __pyx_t_12 = 2;
16873  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_12 = 2;
16874  if (__pyx_t_24 < 0) {
16875  __pyx_t_24 += __pyx_pybuffernd_v.diminfo[3].shape;
16876  if (unlikely(__pyx_t_24 < 0)) __pyx_t_12 = 3;
16877  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_12 = 3;
16878  if (unlikely(__pyx_t_12 != -1)) {
16879  __Pyx_RaiseBufferIndexError(__pyx_t_12);
16880  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16881  }
16882  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_23, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_24, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_19, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_20, __pyx_pybuffernd_x.diminfo[3].strides))));
16883 
16884  /* "subsurfaceTransportFunctions.pyx":834
16885  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
16886  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
16887  * v[eN,ebN,k,2]=zvelocity # <<<<<<<<<<<<<<
16888  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
16889  * else:
16890  */
16891  __pyx_t_25 = __pyx_v_eN;
16892  __pyx_t_26 = __pyx_v_ebN;
16893  __pyx_t_27 = __pyx_v_k;
16894  __pyx_t_28 = 2;
16895  __pyx_t_12 = -1;
16896  if (__pyx_t_25 < 0) {
16897  __pyx_t_25 += __pyx_pybuffernd_v.diminfo[0].shape;
16898  if (unlikely(__pyx_t_25 < 0)) __pyx_t_12 = 0;
16899  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_12 = 0;
16900  if (__pyx_t_26 < 0) {
16901  __pyx_t_26 += __pyx_pybuffernd_v.diminfo[1].shape;
16902  if (unlikely(__pyx_t_26 < 0)) __pyx_t_12 = 1;
16903  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_12 = 1;
16904  if (__pyx_t_27 < 0) {
16905  __pyx_t_27 += __pyx_pybuffernd_v.diminfo[2].shape;
16906  if (unlikely(__pyx_t_27 < 0)) __pyx_t_12 = 2;
16907  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_12 = 2;
16908  if (__pyx_t_28 < 0) {
16909  __pyx_t_28 += __pyx_pybuffernd_v.diminfo[3].shape;
16910  if (unlikely(__pyx_t_28 < 0)) __pyx_t_12 = 3;
16911  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_12 = 3;
16912  if (unlikely(__pyx_t_12 != -1)) {
16913  __Pyx_RaiseBufferIndexError(__pyx_t_12);
16914  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16915  }
16916  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_27, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_28, __pyx_pybuffernd_v.diminfo[3].strides) = __pyx_v_zvelocity;
16917 
16918  /* "subsurfaceTransportFunctions.pyx":835
16919  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
16920  * v[eN,ebN,k,2]=zvelocity
16921  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
16922  * else:
16923  * for eN in range(x.shape[0]):
16924  */
16925  __pyx_t_29 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16926  __Pyx_GOTREF(__pyx_t_29);
16927  __pyx_t_30 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16928  __Pyx_GOTREF(__pyx_t_30);
16929  __pyx_t_31 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16930  __Pyx_GOTREF(__pyx_t_31);
16931  __pyx_t_32 = PyTuple_New(4); if (unlikely(!__pyx_t_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16932  __Pyx_GOTREF(__pyx_t_32);
16933  __Pyx_GIVEREF(__pyx_t_29);
16934  PyTuple_SET_ITEM(__pyx_t_32, 0, __pyx_t_29);
16935  __Pyx_GIVEREF(__pyx_t_30);
16936  PyTuple_SET_ITEM(__pyx_t_32, 1, __pyx_t_30);
16937  __Pyx_GIVEREF(__pyx_t_31);
16938  PyTuple_SET_ITEM(__pyx_t_32, 2, __pyx_t_31);
16939  __Pyx_INCREF(__pyx_slice__5);
16940  __Pyx_GIVEREF(__pyx_slice__5);
16941  PyTuple_SET_ITEM(__pyx_t_32, 3, __pyx_slice__5);
16942  __pyx_t_29 = 0;
16943  __pyx_t_30 = 0;
16944  __pyx_t_31 = 0;
16945  __pyx_t_31 = PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_32); if (unlikely(__pyx_t_31 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
16946  __Pyx_GOTREF(__pyx_t_31);
16947  __pyx_t_33 = (__pyx_v_tForReversal - __pyx_v_t);
16948  __pyx_t_34 = (__pyx_v_tForReversal - 0.0);
16949  if (unlikely(__pyx_t_34 == 0)) {
16950  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
16951  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16952  }
16953  __pyx_t_30 = PyFloat_FromDouble(((__pyx_t_33 / __pyx_t_34) * __pyx_v_clock)); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16954  __Pyx_GOTREF(__pyx_t_30);
16955  __pyx_t_29 = PyNumber_InPlaceMultiply(__pyx_t_31, __pyx_t_30); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16956  __Pyx_GOTREF(__pyx_t_29);
16957  __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
16958  __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
16959  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_32, __pyx_t_29) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16960  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
16961  __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
16962  }
16963  }
16964  }
16965 
16966  /* "subsurfaceTransportFunctions.pyx":828
16967  * pi = M_PI
16968  * if v.shape[-1] == 3:
16969  * if transient == 1: # <<<<<<<<<<<<<<
16970  * for eN in range(x.shape[0]):
16971  * for ebN in range(x.shape[1]):
16972  */
16973  goto __pyx_L4;
16974  }
16975 
16976  /* "subsurfaceTransportFunctions.pyx":837
16977  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
16978  * else:
16979  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
16980  * for ebN in range(x.shape[1]):
16981  * for k in range(x.shape[2]):
16982  */
16983  /*else*/ {
16984  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
16985  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
16986  __pyx_v_eN = __pyx_t_3;
16987 
16988  /* "subsurfaceTransportFunctions.pyx":838
16989  * else:
16990  * for eN in range(x.shape[0]):
16991  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
16992  * for k in range(x.shape[2]):
16993  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
16994  */
16995  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
16996  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
16997  __pyx_v_ebN = __pyx_t_5;
16998 
16999  /* "subsurfaceTransportFunctions.pyx":839
17000  * for eN in range(x.shape[0]):
17001  * for ebN in range(x.shape[1]):
17002  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
17003  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
17004  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
17005  */
17006  __pyx_t_6 = (__pyx_v_x->dimensions[2]);
17007  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
17008  __pyx_v_k = __pyx_t_7;
17009 
17010  /* "subsurfaceTransportFunctions.pyx":840
17011  * for ebN in range(x.shape[1]):
17012  * for k in range(x.shape[2]):
17013  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
17014  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
17015  * v[eN,ebN,k,2]=zvelocity
17016  */
17017  __pyx_t_35 = __pyx_v_eN;
17018  __pyx_t_36 = __pyx_v_ebN;
17019  __pyx_t_37 = __pyx_v_k;
17020  __pyx_t_38 = 1;
17021  __pyx_t_12 = -1;
17022  if (__pyx_t_35 < 0) {
17023  __pyx_t_35 += __pyx_pybuffernd_x.diminfo[0].shape;
17024  if (unlikely(__pyx_t_35 < 0)) __pyx_t_12 = 0;
17025  } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_12 = 0;
17026  if (__pyx_t_36 < 0) {
17027  __pyx_t_36 += __pyx_pybuffernd_x.diminfo[1].shape;
17028  if (unlikely(__pyx_t_36 < 0)) __pyx_t_12 = 1;
17029  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_12 = 1;
17030  if (__pyx_t_37 < 0) {
17031  __pyx_t_37 += __pyx_pybuffernd_x.diminfo[2].shape;
17032  if (unlikely(__pyx_t_37 < 0)) __pyx_t_12 = 2;
17033  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_12 = 2;
17034  if (__pyx_t_38 < 0) {
17035  __pyx_t_38 += __pyx_pybuffernd_x.diminfo[3].shape;
17036  if (unlikely(__pyx_t_38 < 0)) __pyx_t_12 = 3;
17037  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_12 = 3;
17038  if (unlikely(__pyx_t_12 != -1)) {
17039  __Pyx_RaiseBufferIndexError(__pyx_t_12);
17040  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17041  }
17042  __pyx_t_39 = __pyx_v_eN;
17043  __pyx_t_40 = __pyx_v_ebN;
17044  __pyx_t_41 = __pyx_v_k;
17045  __pyx_t_42 = 0;
17046  __pyx_t_12 = -1;
17047  if (__pyx_t_39 < 0) {
17048  __pyx_t_39 += __pyx_pybuffernd_v.diminfo[0].shape;
17049  if (unlikely(__pyx_t_39 < 0)) __pyx_t_12 = 0;
17050  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_12 = 0;
17051  if (__pyx_t_40 < 0) {
17052  __pyx_t_40 += __pyx_pybuffernd_v.diminfo[1].shape;
17053  if (unlikely(__pyx_t_40 < 0)) __pyx_t_12 = 1;
17054  } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_12 = 1;
17055  if (__pyx_t_41 < 0) {
17056  __pyx_t_41 += __pyx_pybuffernd_v.diminfo[2].shape;
17057  if (unlikely(__pyx_t_41 < 0)) __pyx_t_12 = 2;
17058  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_12 = 2;
17059  if (__pyx_t_42 < 0) {
17060  __pyx_t_42 += __pyx_pybuffernd_v.diminfo[3].shape;
17061  if (unlikely(__pyx_t_42 < 0)) __pyx_t_12 = 3;
17062  } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_12 = 3;
17063  if (unlikely(__pyx_t_12 != -1)) {
17064  __Pyx_RaiseBufferIndexError(__pyx_t_12);
17065  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17066  }
17067  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_40, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_41, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_42, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_36, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_37, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_38, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
17068 
17069  /* "subsurfaceTransportFunctions.pyx":841
17070  * for k in range(x.shape[2]):
17071  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
17072  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
17073  * v[eN,ebN,k,2]=zvelocity
17074  * else:
17075  */
17076  __pyx_t_43 = __pyx_v_eN;
17077  __pyx_t_44 = __pyx_v_ebN;
17078  __pyx_t_45 = __pyx_v_k;
17079  __pyx_t_46 = 0;
17080  __pyx_t_12 = -1;
17081  if (__pyx_t_43 < 0) {
17082  __pyx_t_43 += __pyx_pybuffernd_x.diminfo[0].shape;
17083  if (unlikely(__pyx_t_43 < 0)) __pyx_t_12 = 0;
17084  } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_12 = 0;
17085  if (__pyx_t_44 < 0) {
17086  __pyx_t_44 += __pyx_pybuffernd_x.diminfo[1].shape;
17087  if (unlikely(__pyx_t_44 < 0)) __pyx_t_12 = 1;
17088  } else if (unlikely(__pyx_t_44 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_12 = 1;
17089  if (__pyx_t_45 < 0) {
17090  __pyx_t_45 += __pyx_pybuffernd_x.diminfo[2].shape;
17091  if (unlikely(__pyx_t_45 < 0)) __pyx_t_12 = 2;
17092  } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_12 = 2;
17093  if (__pyx_t_46 < 0) {
17094  __pyx_t_46 += __pyx_pybuffernd_x.diminfo[3].shape;
17095  if (unlikely(__pyx_t_46 < 0)) __pyx_t_12 = 3;
17096  } else if (unlikely(__pyx_t_46 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_12 = 3;
17097  if (unlikely(__pyx_t_12 != -1)) {
17098  __Pyx_RaiseBufferIndexError(__pyx_t_12);
17099  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17100  }
17101  __pyx_t_47 = __pyx_v_eN;
17102  __pyx_t_48 = __pyx_v_ebN;
17103  __pyx_t_49 = __pyx_v_k;
17104  __pyx_t_50 = 1;
17105  __pyx_t_12 = -1;
17106  if (__pyx_t_47 < 0) {
17107  __pyx_t_47 += __pyx_pybuffernd_v.diminfo[0].shape;
17108  if (unlikely(__pyx_t_47 < 0)) __pyx_t_12 = 0;
17109  } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_12 = 0;
17110  if (__pyx_t_48 < 0) {
17111  __pyx_t_48 += __pyx_pybuffernd_v.diminfo[1].shape;
17112  if (unlikely(__pyx_t_48 < 0)) __pyx_t_12 = 1;
17113  } else if (unlikely(__pyx_t_48 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_12 = 1;
17114  if (__pyx_t_49 < 0) {
17115  __pyx_t_49 += __pyx_pybuffernd_v.diminfo[2].shape;
17116  if (unlikely(__pyx_t_49 < 0)) __pyx_t_12 = 2;
17117  } else if (unlikely(__pyx_t_49 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_12 = 2;
17118  if (__pyx_t_50 < 0) {
17119  __pyx_t_50 += __pyx_pybuffernd_v.diminfo[3].shape;
17120  if (unlikely(__pyx_t_50 < 0)) __pyx_t_12 = 3;
17121  } else if (unlikely(__pyx_t_50 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_12 = 3;
17122  if (unlikely(__pyx_t_12 != -1)) {
17123  __Pyx_RaiseBufferIndexError(__pyx_t_12);
17124  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17125  }
17126  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_48, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_49, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_50, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_44, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_45, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_46, __pyx_pybuffernd_x.diminfo[3].strides))));
17127 
17128  /* "subsurfaceTransportFunctions.pyx":842
17129  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
17130  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
17131  * v[eN,ebN,k,2]=zvelocity # <<<<<<<<<<<<<<
17132  * else:
17133  * assert v.shape[-1] == 2
17134  */
17135  __pyx_t_51 = __pyx_v_eN;
17136  __pyx_t_52 = __pyx_v_ebN;
17137  __pyx_t_53 = __pyx_v_k;
17138  __pyx_t_54 = 2;
17139  __pyx_t_12 = -1;
17140  if (__pyx_t_51 < 0) {
17141  __pyx_t_51 += __pyx_pybuffernd_v.diminfo[0].shape;
17142  if (unlikely(__pyx_t_51 < 0)) __pyx_t_12 = 0;
17143  } else if (unlikely(__pyx_t_51 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_12 = 0;
17144  if (__pyx_t_52 < 0) {
17145  __pyx_t_52 += __pyx_pybuffernd_v.diminfo[1].shape;
17146  if (unlikely(__pyx_t_52 < 0)) __pyx_t_12 = 1;
17147  } else if (unlikely(__pyx_t_52 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_12 = 1;
17148  if (__pyx_t_53 < 0) {
17149  __pyx_t_53 += __pyx_pybuffernd_v.diminfo[2].shape;
17150  if (unlikely(__pyx_t_53 < 0)) __pyx_t_12 = 2;
17151  } else if (unlikely(__pyx_t_53 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_12 = 2;
17152  if (__pyx_t_54 < 0) {
17153  __pyx_t_54 += __pyx_pybuffernd_v.diminfo[3].shape;
17154  if (unlikely(__pyx_t_54 < 0)) __pyx_t_12 = 3;
17155  } else if (unlikely(__pyx_t_54 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_12 = 3;
17156  if (unlikely(__pyx_t_12 != -1)) {
17157  __Pyx_RaiseBufferIndexError(__pyx_t_12);
17158  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17159  }
17160  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_52, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_53, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_54, __pyx_pybuffernd_v.diminfo[3].strides) = __pyx_v_zvelocity;
17161  }
17162  }
17163  }
17164  }
17165  __pyx_L4:;
17166 
17167  /* "subsurfaceTransportFunctions.pyx":827
17168  * cdef double pi
17169  * pi = M_PI
17170  * if v.shape[-1] == 3: # <<<<<<<<<<<<<<
17171  * if transient == 1:
17172  * for eN in range(x.shape[0]):
17173  */
17174  goto __pyx_L3;
17175  }
17176 
17177  /* "subsurfaceTransportFunctions.pyx":844
17178  * v[eN,ebN,k,2]=zvelocity
17179  * else:
17180  * assert v.shape[-1] == 2 # <<<<<<<<<<<<<<
17181  * if transient == 1:
17182  * for eN in range(x.shape[0]):
17183  */
17184  /*else*/ {
17185  #ifndef CYTHON_WITHOUT_ASSERTIONS
17186  if (unlikely(!Py_OptimizeFlag)) {
17187  if (unlikely(!(((__pyx_v_v->dimensions[-1L]) == 2) != 0))) {
17188  PyErr_SetNone(PyExc_AssertionError);
17189  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17190  }
17191  }
17192  #endif
17193 
17194  /* "subsurfaceTransportFunctions.pyx":845
17195  * else:
17196  * assert v.shape[-1] == 2
17197  * if transient == 1: # <<<<<<<<<<<<<<
17198  * for eN in range(x.shape[0]):
17199  * for ebN in range(x.shape[1]):
17200  */
17201  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
17202  if (__pyx_t_1) {
17203 
17204  /* "subsurfaceTransportFunctions.pyx":846
17205  * assert v.shape[-1] == 2
17206  * if transient == 1:
17207  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
17208  * for ebN in range(x.shape[1]):
17209  * for k in range(x.shape[2]):
17210  */
17211  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
17212  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
17213  __pyx_v_eN = __pyx_t_3;
17214 
17215  /* "subsurfaceTransportFunctions.pyx":847
17216  * if transient == 1:
17217  * for eN in range(x.shape[0]):
17218  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
17219  * for k in range(x.shape[2]):
17220  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
17221  */
17222  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
17223  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
17224  __pyx_v_ebN = __pyx_t_5;
17225 
17226  /* "subsurfaceTransportFunctions.pyx":848
17227  * for eN in range(x.shape[0]):
17228  * for ebN in range(x.shape[1]):
17229  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
17230  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
17231  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
17232  */
17233  __pyx_t_6 = (__pyx_v_x->dimensions[2]);
17234  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
17235  __pyx_v_k = __pyx_t_7;
17236 
17237  /* "subsurfaceTransportFunctions.pyx":849
17238  * for ebN in range(x.shape[1]):
17239  * for k in range(x.shape[2]):
17240  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
17241  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
17242  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17243  */
17244  __pyx_t_55 = __pyx_v_eN;
17245  __pyx_t_56 = __pyx_v_ebN;
17246  __pyx_t_57 = __pyx_v_k;
17247  __pyx_t_58 = 1;
17248  __pyx_t_12 = -1;
17249  if (__pyx_t_55 < 0) {
17250  __pyx_t_55 += __pyx_pybuffernd_x.diminfo[0].shape;
17251  if (unlikely(__pyx_t_55 < 0)) __pyx_t_12 = 0;
17252  } else if (unlikely(__pyx_t_55 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_12 = 0;
17253  if (__pyx_t_56 < 0) {
17254  __pyx_t_56 += __pyx_pybuffernd_x.diminfo[1].shape;
17255  if (unlikely(__pyx_t_56 < 0)) __pyx_t_12 = 1;
17256  } else if (unlikely(__pyx_t_56 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_12 = 1;
17257  if (__pyx_t_57 < 0) {
17258  __pyx_t_57 += __pyx_pybuffernd_x.diminfo[2].shape;
17259  if (unlikely(__pyx_t_57 < 0)) __pyx_t_12 = 2;
17260  } else if (unlikely(__pyx_t_57 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_12 = 2;
17261  if (__pyx_t_58 < 0) {
17262  __pyx_t_58 += __pyx_pybuffernd_x.diminfo[3].shape;
17263  if (unlikely(__pyx_t_58 < 0)) __pyx_t_12 = 3;
17264  } else if (unlikely(__pyx_t_58 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_12 = 3;
17265  if (unlikely(__pyx_t_12 != -1)) {
17266  __Pyx_RaiseBufferIndexError(__pyx_t_12);
17267  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17268  }
17269  __pyx_t_59 = __pyx_v_eN;
17270  __pyx_t_60 = __pyx_v_ebN;
17271  __pyx_t_61 = __pyx_v_k;
17272  __pyx_t_62 = 0;
17273  __pyx_t_12 = -1;
17274  if (__pyx_t_59 < 0) {
17275  __pyx_t_59 += __pyx_pybuffernd_v.diminfo[0].shape;
17276  if (unlikely(__pyx_t_59 < 0)) __pyx_t_12 = 0;
17277  } else if (unlikely(__pyx_t_59 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_12 = 0;
17278  if (__pyx_t_60 < 0) {
17279  __pyx_t_60 += __pyx_pybuffernd_v.diminfo[1].shape;
17280  if (unlikely(__pyx_t_60 < 0)) __pyx_t_12 = 1;
17281  } else if (unlikely(__pyx_t_60 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_12 = 1;
17282  if (__pyx_t_61 < 0) {
17283  __pyx_t_61 += __pyx_pybuffernd_v.diminfo[2].shape;
17284  if (unlikely(__pyx_t_61 < 0)) __pyx_t_12 = 2;
17285  } else if (unlikely(__pyx_t_61 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_12 = 2;
17286  if (__pyx_t_62 < 0) {
17287  __pyx_t_62 += __pyx_pybuffernd_v.diminfo[3].shape;
17288  if (unlikely(__pyx_t_62 < 0)) __pyx_t_12 = 3;
17289  } else if (unlikely(__pyx_t_62 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_12 = 3;
17290  if (unlikely(__pyx_t_12 != -1)) {
17291  __Pyx_RaiseBufferIndexError(__pyx_t_12);
17292  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17293  }
17294  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_59, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_60, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_61, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_62, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_55, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_56, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_57, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_58, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
17295 
17296  /* "subsurfaceTransportFunctions.pyx":850
17297  * for k in range(x.shape[2]):
17298  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
17299  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
17300  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17301  * else:
17302  */
17303  __pyx_t_63 = __pyx_v_eN;
17304  __pyx_t_64 = __pyx_v_ebN;
17305  __pyx_t_65 = __pyx_v_k;
17306  __pyx_t_66 = 0;
17307  __pyx_t_12 = -1;
17308  if (__pyx_t_63 < 0) {
17309  __pyx_t_63 += __pyx_pybuffernd_x.diminfo[0].shape;
17310  if (unlikely(__pyx_t_63 < 0)) __pyx_t_12 = 0;
17311  } else if (unlikely(__pyx_t_63 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_12 = 0;
17312  if (__pyx_t_64 < 0) {
17313  __pyx_t_64 += __pyx_pybuffernd_x.diminfo[1].shape;
17314  if (unlikely(__pyx_t_64 < 0)) __pyx_t_12 = 1;
17315  } else if (unlikely(__pyx_t_64 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_12 = 1;
17316  if (__pyx_t_65 < 0) {
17317  __pyx_t_65 += __pyx_pybuffernd_x.diminfo[2].shape;
17318  if (unlikely(__pyx_t_65 < 0)) __pyx_t_12 = 2;
17319  } else if (unlikely(__pyx_t_65 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_12 = 2;
17320  if (__pyx_t_66 < 0) {
17321  __pyx_t_66 += __pyx_pybuffernd_x.diminfo[3].shape;
17322  if (unlikely(__pyx_t_66 < 0)) __pyx_t_12 = 3;
17323  } else if (unlikely(__pyx_t_66 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_12 = 3;
17324  if (unlikely(__pyx_t_12 != -1)) {
17325  __Pyx_RaiseBufferIndexError(__pyx_t_12);
17326  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17327  }
17328  __pyx_t_67 = __pyx_v_eN;
17329  __pyx_t_68 = __pyx_v_ebN;
17330  __pyx_t_69 = __pyx_v_k;
17331  __pyx_t_70 = 1;
17332  __pyx_t_12 = -1;
17333  if (__pyx_t_67 < 0) {
17334  __pyx_t_67 += __pyx_pybuffernd_v.diminfo[0].shape;
17335  if (unlikely(__pyx_t_67 < 0)) __pyx_t_12 = 0;
17336  } else if (unlikely(__pyx_t_67 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_12 = 0;
17337  if (__pyx_t_68 < 0) {
17338  __pyx_t_68 += __pyx_pybuffernd_v.diminfo[1].shape;
17339  if (unlikely(__pyx_t_68 < 0)) __pyx_t_12 = 1;
17340  } else if (unlikely(__pyx_t_68 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_12 = 1;
17341  if (__pyx_t_69 < 0) {
17342  __pyx_t_69 += __pyx_pybuffernd_v.diminfo[2].shape;
17343  if (unlikely(__pyx_t_69 < 0)) __pyx_t_12 = 2;
17344  } else if (unlikely(__pyx_t_69 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_12 = 2;
17345  if (__pyx_t_70 < 0) {
17346  __pyx_t_70 += __pyx_pybuffernd_v.diminfo[3].shape;
17347  if (unlikely(__pyx_t_70 < 0)) __pyx_t_12 = 3;
17348  } else if (unlikely(__pyx_t_70 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_12 = 3;
17349  if (unlikely(__pyx_t_12 != -1)) {
17350  __Pyx_RaiseBufferIndexError(__pyx_t_12);
17351  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17352  }
17353  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_67, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_68, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_69, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_70, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_63, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_64, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_65, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_66, __pyx_pybuffernd_x.diminfo[3].strides))));
17354 
17355  /* "subsurfaceTransportFunctions.pyx":851
17356  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
17357  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
17358  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
17359  * else:
17360  * for eN in range(x.shape[0]):
17361  */
17362  __pyx_t_32 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17363  __Pyx_GOTREF(__pyx_t_32);
17364  __pyx_t_29 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17365  __Pyx_GOTREF(__pyx_t_29);
17366  __pyx_t_30 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17367  __Pyx_GOTREF(__pyx_t_30);
17368  __pyx_t_31 = PyTuple_New(4); if (unlikely(!__pyx_t_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17369  __Pyx_GOTREF(__pyx_t_31);
17370  __Pyx_GIVEREF(__pyx_t_32);
17371  PyTuple_SET_ITEM(__pyx_t_31, 0, __pyx_t_32);
17372  __Pyx_GIVEREF(__pyx_t_29);
17373  PyTuple_SET_ITEM(__pyx_t_31, 1, __pyx_t_29);
17374  __Pyx_GIVEREF(__pyx_t_30);
17375  PyTuple_SET_ITEM(__pyx_t_31, 2, __pyx_t_30);
17376  __Pyx_INCREF(__pyx_slice__6);
17377  __Pyx_GIVEREF(__pyx_slice__6);
17378  PyTuple_SET_ITEM(__pyx_t_31, 3, __pyx_slice__6);
17379  __pyx_t_32 = 0;
17380  __pyx_t_29 = 0;
17381  __pyx_t_30 = 0;
17382  __pyx_t_30 = PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_31); if (unlikely(__pyx_t_30 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
17383  __Pyx_GOTREF(__pyx_t_30);
17384  __pyx_t_34 = (__pyx_v_tForReversal - __pyx_v_t);
17385  __pyx_t_33 = (__pyx_v_tForReversal - 0.0);
17386  if (unlikely(__pyx_t_33 == 0)) {
17387  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
17388  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17389  }
17390  __pyx_t_29 = PyFloat_FromDouble(((__pyx_t_34 / __pyx_t_33) * __pyx_v_clock)); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17391  __Pyx_GOTREF(__pyx_t_29);
17392  __pyx_t_32 = PyNumber_InPlaceMultiply(__pyx_t_30, __pyx_t_29); if (unlikely(!__pyx_t_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17393  __Pyx_GOTREF(__pyx_t_32);
17394  __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
17395  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
17396  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_31, __pyx_t_32) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17397  __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
17398  __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
17399  }
17400  }
17401  }
17402 
17403  /* "subsurfaceTransportFunctions.pyx":845
17404  * else:
17405  * assert v.shape[-1] == 2
17406  * if transient == 1: # <<<<<<<<<<<<<<
17407  * for eN in range(x.shape[0]):
17408  * for ebN in range(x.shape[1]):
17409  */
17410  goto __pyx_L17;
17411  }
17412 
17413  /* "subsurfaceTransportFunctions.pyx":853
17414  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17415  * else:
17416  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
17417  * for ebN in range(x.shape[1]):
17418  * for k in range(x.shape[2]):
17419  */
17420  /*else*/ {
17421  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
17422  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
17423  __pyx_v_eN = __pyx_t_3;
17424 
17425  /* "subsurfaceTransportFunctions.pyx":854
17426  * else:
17427  * for eN in range(x.shape[0]):
17428  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
17429  * for k in range(x.shape[2]):
17430  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
17431  */
17432  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
17433  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
17434  __pyx_v_ebN = __pyx_t_5;
17435 
17436  /* "subsurfaceTransportFunctions.pyx":855
17437  * for eN in range(x.shape[0]):
17438  * for ebN in range(x.shape[1]):
17439  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
17440  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
17441  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
17442  */
17443  __pyx_t_6 = (__pyx_v_x->dimensions[2]);
17444  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
17445  __pyx_v_k = __pyx_t_7;
17446 
17447  /* "subsurfaceTransportFunctions.pyx":856
17448  * for ebN in range(x.shape[1]):
17449  * for k in range(x.shape[2]):
17450  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
17451  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
17452  *
17453  */
17454  __pyx_t_71 = __pyx_v_eN;
17455  __pyx_t_72 = __pyx_v_ebN;
17456  __pyx_t_73 = __pyx_v_k;
17457  __pyx_t_74 = 1;
17458  __pyx_t_12 = -1;
17459  if (__pyx_t_71 < 0) {
17460  __pyx_t_71 += __pyx_pybuffernd_x.diminfo[0].shape;
17461  if (unlikely(__pyx_t_71 < 0)) __pyx_t_12 = 0;
17462  } else if (unlikely(__pyx_t_71 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_12 = 0;
17463  if (__pyx_t_72 < 0) {
17464  __pyx_t_72 += __pyx_pybuffernd_x.diminfo[1].shape;
17465  if (unlikely(__pyx_t_72 < 0)) __pyx_t_12 = 1;
17466  } else if (unlikely(__pyx_t_72 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_12 = 1;
17467  if (__pyx_t_73 < 0) {
17468  __pyx_t_73 += __pyx_pybuffernd_x.diminfo[2].shape;
17469  if (unlikely(__pyx_t_73 < 0)) __pyx_t_12 = 2;
17470  } else if (unlikely(__pyx_t_73 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_12 = 2;
17471  if (__pyx_t_74 < 0) {
17472  __pyx_t_74 += __pyx_pybuffernd_x.diminfo[3].shape;
17473  if (unlikely(__pyx_t_74 < 0)) __pyx_t_12 = 3;
17474  } else if (unlikely(__pyx_t_74 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_12 = 3;
17475  if (unlikely(__pyx_t_12 != -1)) {
17476  __Pyx_RaiseBufferIndexError(__pyx_t_12);
17477  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17478  }
17479  __pyx_t_75 = __pyx_v_eN;
17480  __pyx_t_76 = __pyx_v_ebN;
17481  __pyx_t_77 = __pyx_v_k;
17482  __pyx_t_78 = 0;
17483  __pyx_t_12 = -1;
17484  if (__pyx_t_75 < 0) {
17485  __pyx_t_75 += __pyx_pybuffernd_v.diminfo[0].shape;
17486  if (unlikely(__pyx_t_75 < 0)) __pyx_t_12 = 0;
17487  } else if (unlikely(__pyx_t_75 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_12 = 0;
17488  if (__pyx_t_76 < 0) {
17489  __pyx_t_76 += __pyx_pybuffernd_v.diminfo[1].shape;
17490  if (unlikely(__pyx_t_76 < 0)) __pyx_t_12 = 1;
17491  } else if (unlikely(__pyx_t_76 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_12 = 1;
17492  if (__pyx_t_77 < 0) {
17493  __pyx_t_77 += __pyx_pybuffernd_v.diminfo[2].shape;
17494  if (unlikely(__pyx_t_77 < 0)) __pyx_t_12 = 2;
17495  } else if (unlikely(__pyx_t_77 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_12 = 2;
17496  if (__pyx_t_78 < 0) {
17497  __pyx_t_78 += __pyx_pybuffernd_v.diminfo[3].shape;
17498  if (unlikely(__pyx_t_78 < 0)) __pyx_t_12 = 3;
17499  } else if (unlikely(__pyx_t_78 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_12 = 3;
17500  if (unlikely(__pyx_t_12 != -1)) {
17501  __Pyx_RaiseBufferIndexError(__pyx_t_12);
17502  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17503  }
17504  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_75, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_76, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_77, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_78, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_71, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_72, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_73, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_74, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
17505 
17506  /* "subsurfaceTransportFunctions.pyx":857
17507  * for k in range(x.shape[2]):
17508  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
17509  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
17510  *
17511  * def helicalElementVelocityEval3(int transient,
17512  */
17513  __pyx_t_79 = __pyx_v_eN;
17514  __pyx_t_80 = __pyx_v_ebN;
17515  __pyx_t_81 = __pyx_v_k;
17516  __pyx_t_82 = 0;
17517  __pyx_t_12 = -1;
17518  if (__pyx_t_79 < 0) {
17519  __pyx_t_79 += __pyx_pybuffernd_x.diminfo[0].shape;
17520  if (unlikely(__pyx_t_79 < 0)) __pyx_t_12 = 0;
17521  } else if (unlikely(__pyx_t_79 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_12 = 0;
17522  if (__pyx_t_80 < 0) {
17523  __pyx_t_80 += __pyx_pybuffernd_x.diminfo[1].shape;
17524  if (unlikely(__pyx_t_80 < 0)) __pyx_t_12 = 1;
17525  } else if (unlikely(__pyx_t_80 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_12 = 1;
17526  if (__pyx_t_81 < 0) {
17527  __pyx_t_81 += __pyx_pybuffernd_x.diminfo[2].shape;
17528  if (unlikely(__pyx_t_81 < 0)) __pyx_t_12 = 2;
17529  } else if (unlikely(__pyx_t_81 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_12 = 2;
17530  if (__pyx_t_82 < 0) {
17531  __pyx_t_82 += __pyx_pybuffernd_x.diminfo[3].shape;
17532  if (unlikely(__pyx_t_82 < 0)) __pyx_t_12 = 3;
17533  } else if (unlikely(__pyx_t_82 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_12 = 3;
17534  if (unlikely(__pyx_t_12 != -1)) {
17535  __Pyx_RaiseBufferIndexError(__pyx_t_12);
17536  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17537  }
17538  __pyx_t_83 = __pyx_v_eN;
17539  __pyx_t_84 = __pyx_v_ebN;
17540  __pyx_t_85 = __pyx_v_k;
17541  __pyx_t_86 = 1;
17542  __pyx_t_12 = -1;
17543  if (__pyx_t_83 < 0) {
17544  __pyx_t_83 += __pyx_pybuffernd_v.diminfo[0].shape;
17545  if (unlikely(__pyx_t_83 < 0)) __pyx_t_12 = 0;
17546  } else if (unlikely(__pyx_t_83 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_12 = 0;
17547  if (__pyx_t_84 < 0) {
17548  __pyx_t_84 += __pyx_pybuffernd_v.diminfo[1].shape;
17549  if (unlikely(__pyx_t_84 < 0)) __pyx_t_12 = 1;
17550  } else if (unlikely(__pyx_t_84 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_12 = 1;
17551  if (__pyx_t_85 < 0) {
17552  __pyx_t_85 += __pyx_pybuffernd_v.diminfo[2].shape;
17553  if (unlikely(__pyx_t_85 < 0)) __pyx_t_12 = 2;
17554  } else if (unlikely(__pyx_t_85 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_12 = 2;
17555  if (__pyx_t_86 < 0) {
17556  __pyx_t_86 += __pyx_pybuffernd_v.diminfo[3].shape;
17557  if (unlikely(__pyx_t_86 < 0)) __pyx_t_12 = 3;
17558  } else if (unlikely(__pyx_t_86 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_12 = 3;
17559  if (unlikely(__pyx_t_12 != -1)) {
17560  __Pyx_RaiseBufferIndexError(__pyx_t_12);
17561  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17562  }
17563  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_83, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_84, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_85, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_86, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_79, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_80, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_81, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_82, __pyx_pybuffernd_x.diminfo[3].strides))));
17564  }
17565  }
17566  }
17567  }
17568  __pyx_L17:;
17569  }
17570  __pyx_L3:;
17571 
17572  /* "subsurfaceTransportFunctions.pyx":816
17573  *
17574  *
17575  * def rotatingGaussianElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
17576  * double t,
17577  * double tForReversal,
17578  */
17579 
17580  /* function exit code */
17581  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
17582  goto __pyx_L0;
17583  __pyx_L1_error:;
17584  __Pyx_XDECREF(__pyx_t_29);
17585  __Pyx_XDECREF(__pyx_t_30);
17586  __Pyx_XDECREF(__pyx_t_31);
17587  __Pyx_XDECREF(__pyx_t_32);
17588  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
17589  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
17590  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
17591  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
17592  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
17593  __Pyx_AddTraceback("subsurfaceTransportFunctions.rotatingGaussianElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
17594  __pyx_r = NULL;
17595  goto __pyx_L2;
17596  __pyx_L0:;
17597  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
17598  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
17599  __pyx_L2:;
17600  __Pyx_XGIVEREF(__pyx_r);
17601  __Pyx_RefNannyFinishContext();
17602  return __pyx_r;
17603 }
17604 
17605 /* "subsurfaceTransportFunctions.pyx":859
17606  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
17607  *
17608  * def helicalElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
17609  * double t,
17610  * double tForReversal,
17611  */
17612 
17613 /* Python wrapper */
17614 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_51helicalElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
17615 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_51helicalElementVelocityEval3 = {"helicalElementVelocityEval3", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_51helicalElementVelocityEval3, METH_VARARGS|METH_KEYWORDS, 0};
17616 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_51helicalElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
17617  int __pyx_v_transient;
17618  double __pyx_v_t;
17619  double __pyx_v_tForReversal;
17620  double __pyx_v_clock;
17621  double __pyx_v_zVelocity;
17622  double __pyx_v_xc;
17623  double __pyx_v_yc;
17624  PyArrayObject *__pyx_v_x = 0;
17625  PyArrayObject *__pyx_v_v = 0;
17626  int __pyx_lineno = 0;
17627  const char *__pyx_filename = NULL;
17628  int __pyx_clineno = 0;
17629  PyObject *__pyx_r = 0;
17630  __Pyx_RefNannyDeclarations
17631  __Pyx_RefNannySetupContext("helicalElementVelocityEval3 (wrapper)", 0);
17632  {
17633  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_transient,&__pyx_n_s_t,&__pyx_n_s_tForReversal,&__pyx_n_s_clock,&__pyx_n_s_zVelocity,&__pyx_n_s_xc,&__pyx_n_s_yc,&__pyx_n_s_x,&__pyx_n_s_v,0};
17634  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
17635  if (unlikely(__pyx_kwds)) {
17636  Py_ssize_t kw_args;
17637  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
17638  switch (pos_args) {
17639  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
17640  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
17641  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
17642  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
17643  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
17644  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
17645  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
17646  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17647  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17648  case 0: break;
17649  default: goto __pyx_L5_argtuple_error;
17650  }
17651  kw_args = PyDict_Size(__pyx_kwds);
17652  switch (pos_args) {
17653  case 0:
17654  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_transient)) != 0)) kw_args--;
17655  else goto __pyx_L5_argtuple_error;
17656  case 1:
17657  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
17658  else {
17659  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
17660  }
17661  case 2:
17662  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tForReversal)) != 0)) kw_args--;
17663  else {
17664  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
17665  }
17666  case 3:
17667  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_clock)) != 0)) kw_args--;
17668  else {
17669  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
17670  }
17671  case 4:
17672  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_zVelocity)) != 0)) kw_args--;
17673  else {
17674  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
17675  }
17676  case 5:
17677  if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_xc)) != 0)) kw_args--;
17678  else {
17679  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
17680  }
17681  case 6:
17682  if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_yc)) != 0)) kw_args--;
17683  else {
17684  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
17685  }
17686  case 7:
17687  if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
17688  else {
17689  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
17690  }
17691  case 8:
17692  if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
17693  else {
17694  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
17695  }
17696  }
17697  if (unlikely(kw_args > 0)) {
17698  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "helicalElementVelocityEval3") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
17699  }
17700  } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
17701  goto __pyx_L5_argtuple_error;
17702  } else {
17703  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17704  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17705  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
17706  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
17707  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
17708  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
17709  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
17710  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
17711  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
17712  }
17713  __pyx_v_transient = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_transient == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
17714  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
17715  __pyx_v_tForReversal = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tForReversal == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
17716  __pyx_v_clock = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_clock == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
17717  __pyx_v_zVelocity = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_zVelocity == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
17718  __pyx_v_xc = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_xc == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
17719  __pyx_v_yc = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_yc == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
17720  __pyx_v_x = ((PyArrayObject *)values[7]);
17721  __pyx_v_v = ((PyArrayObject *)values[8]);
17722  }
17723  goto __pyx_L4_argument_unpacking_done;
17724  __pyx_L5_argtuple_error:;
17725  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
17726  __pyx_L3_error:;
17727  __Pyx_AddTraceback("subsurfaceTransportFunctions.helicalElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
17728  __Pyx_RefNannyFinishContext();
17729  return NULL;
17730  __pyx_L4_argument_unpacking_done:;
17731  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17732  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17733  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_50helicalElementVelocityEval3(__pyx_self, __pyx_v_transient, __pyx_v_t, __pyx_v_tForReversal, __pyx_v_clock, __pyx_v_zVelocity, __pyx_v_xc, __pyx_v_yc, __pyx_v_x, __pyx_v_v);
17734 
17735  /* function exit code */
17736  goto __pyx_L0;
17737  __pyx_L1_error:;
17738  __pyx_r = NULL;
17739  __pyx_L0:;
17740  __Pyx_RefNannyFinishContext();
17741  return __pyx_r;
17742 }
17743 
17744 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_50helicalElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_zVelocity, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v) {
17745  int __pyx_v_eN;
17746  int __pyx_v_k;
17747  double __pyx_v_pi;
17748  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
17749  __Pyx_Buffer __pyx_pybuffer_v;
17750  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
17751  __Pyx_Buffer __pyx_pybuffer_x;
17752  PyObject *__pyx_r = NULL;
17753  __Pyx_RefNannyDeclarations
17754  int __pyx_t_1;
17755  npy_intp __pyx_t_2;
17756  int __pyx_t_3;
17757  npy_intp __pyx_t_4;
17758  int __pyx_t_5;
17759  Py_ssize_t __pyx_t_6;
17760  Py_ssize_t __pyx_t_7;
17761  Py_ssize_t __pyx_t_8;
17762  int __pyx_t_9;
17763  Py_ssize_t __pyx_t_10;
17764  Py_ssize_t __pyx_t_11;
17765  Py_ssize_t __pyx_t_12;
17766  Py_ssize_t __pyx_t_13;
17767  Py_ssize_t __pyx_t_14;
17768  Py_ssize_t __pyx_t_15;
17769  Py_ssize_t __pyx_t_16;
17770  Py_ssize_t __pyx_t_17;
17771  Py_ssize_t __pyx_t_18;
17772  Py_ssize_t __pyx_t_19;
17773  Py_ssize_t __pyx_t_20;
17774  Py_ssize_t __pyx_t_21;
17775  PyObject *__pyx_t_22 = NULL;
17776  PyObject *__pyx_t_23 = NULL;
17777  PyObject *__pyx_t_24 = NULL;
17778  double __pyx_t_25;
17779  double __pyx_t_26;
17780  PyObject *__pyx_t_27 = NULL;
17781  Py_ssize_t __pyx_t_28;
17782  Py_ssize_t __pyx_t_29;
17783  Py_ssize_t __pyx_t_30;
17784  Py_ssize_t __pyx_t_31;
17785  Py_ssize_t __pyx_t_32;
17786  Py_ssize_t __pyx_t_33;
17787  Py_ssize_t __pyx_t_34;
17788  Py_ssize_t __pyx_t_35;
17789  Py_ssize_t __pyx_t_36;
17790  Py_ssize_t __pyx_t_37;
17791  Py_ssize_t __pyx_t_38;
17792  Py_ssize_t __pyx_t_39;
17793  Py_ssize_t __pyx_t_40;
17794  Py_ssize_t __pyx_t_41;
17795  Py_ssize_t __pyx_t_42;
17796  int __pyx_lineno = 0;
17797  const char *__pyx_filename = NULL;
17798  int __pyx_clineno = 0;
17799  __Pyx_RefNannySetupContext("helicalElementVelocityEval3", 0);
17800  __pyx_pybuffer_x.pybuffer.buf = NULL;
17801  __pyx_pybuffer_x.refcount = 0;
17802  __pyx_pybuffernd_x.data = NULL;
17803  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
17804  __pyx_pybuffer_v.pybuffer.buf = NULL;
17805  __pyx_pybuffer_v.refcount = 0;
17806  __pyx_pybuffernd_v.data = NULL;
17807  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
17808  {
17809  __Pyx_BufFmt_StackElem __pyx_stack[1];
17810  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17811  }
17812  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
17813  {
17814  __Pyx_BufFmt_StackElem __pyx_stack[1];
17815  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17816  }
17817  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2];
17818 
17819  /* "subsurfaceTransportFunctions.pyx":869
17820  * cdef int eN,k
17821  * cdef double pi
17822  * pi = M_PI # <<<<<<<<<<<<<<
17823  * if transient == 1:
17824  * for eN in range(x.shape[0]):
17825  */
17826  __pyx_v_pi = M_PI;
17827 
17828  /* "subsurfaceTransportFunctions.pyx":870
17829  * cdef double pi
17830  * pi = M_PI
17831  * if transient == 1: # <<<<<<<<<<<<<<
17832  * for eN in range(x.shape[0]):
17833  * for k in range(x.shape[1]):
17834  */
17835  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
17836  if (__pyx_t_1) {
17837 
17838  /* "subsurfaceTransportFunctions.pyx":871
17839  * pi = M_PI
17840  * if transient == 1:
17841  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
17842  * for k in range(x.shape[1]):
17843  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17844  */
17845  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
17846  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
17847  __pyx_v_eN = __pyx_t_3;
17848 
17849  /* "subsurfaceTransportFunctions.pyx":872
17850  * if transient == 1:
17851  * for eN in range(x.shape[0]):
17852  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
17853  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17854  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17855  */
17856  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
17857  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
17858  __pyx_v_k = __pyx_t_5;
17859 
17860  /* "subsurfaceTransportFunctions.pyx":873
17861  * for eN in range(x.shape[0]):
17862  * for k in range(x.shape[1]):
17863  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
17864  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17865  * v[eN,k,2]=zVelocity
17866  */
17867  __pyx_t_6 = __pyx_v_eN;
17868  __pyx_t_7 = __pyx_v_k;
17869  __pyx_t_8 = 1;
17870  __pyx_t_9 = -1;
17871  if (__pyx_t_6 < 0) {
17872  __pyx_t_6 += __pyx_pybuffernd_x.diminfo[0].shape;
17873  if (unlikely(__pyx_t_6 < 0)) __pyx_t_9 = 0;
17874  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_9 = 0;
17875  if (__pyx_t_7 < 0) {
17876  __pyx_t_7 += __pyx_pybuffernd_x.diminfo[1].shape;
17877  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 1;
17878  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_9 = 1;
17879  if (__pyx_t_8 < 0) {
17880  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[2].shape;
17881  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 2;
17882  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_9 = 2;
17883  if (unlikely(__pyx_t_9 != -1)) {
17884  __Pyx_RaiseBufferIndexError(__pyx_t_9);
17885  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17886  }
17887  __pyx_t_10 = __pyx_v_eN;
17888  __pyx_t_11 = __pyx_v_k;
17889  __pyx_t_12 = 0;
17890  __pyx_t_9 = -1;
17891  if (__pyx_t_10 < 0) {
17892  __pyx_t_10 += __pyx_pybuffernd_v.diminfo[0].shape;
17893  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
17894  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_9 = 0;
17895  if (__pyx_t_11 < 0) {
17896  __pyx_t_11 += __pyx_pybuffernd_v.diminfo[1].shape;
17897  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
17898  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_9 = 1;
17899  if (__pyx_t_12 < 0) {
17900  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[2].shape;
17901  if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 2;
17902  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_9 = 2;
17903  if (unlikely(__pyx_t_9 != -1)) {
17904  __Pyx_RaiseBufferIndexError(__pyx_t_9);
17905  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17906  }
17907  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_8, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
17908 
17909  /* "subsurfaceTransportFunctions.pyx":874
17910  * for k in range(x.shape[1]):
17911  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17912  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
17913  * v[eN,k,2]=zVelocity
17914  * v[eN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
17915  */
17916  __pyx_t_13 = __pyx_v_eN;
17917  __pyx_t_14 = __pyx_v_k;
17918  __pyx_t_15 = 0;
17919  __pyx_t_9 = -1;
17920  if (__pyx_t_13 < 0) {
17921  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[0].shape;
17922  if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 0;
17923  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_9 = 0;
17924  if (__pyx_t_14 < 0) {
17925  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[1].shape;
17926  if (unlikely(__pyx_t_14 < 0)) __pyx_t_9 = 1;
17927  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_9 = 1;
17928  if (__pyx_t_15 < 0) {
17929  __pyx_t_15 += __pyx_pybuffernd_x.diminfo[2].shape;
17930  if (unlikely(__pyx_t_15 < 0)) __pyx_t_9 = 2;
17931  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_9 = 2;
17932  if (unlikely(__pyx_t_9 != -1)) {
17933  __Pyx_RaiseBufferIndexError(__pyx_t_9);
17934  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17935  }
17936  __pyx_t_16 = __pyx_v_eN;
17937  __pyx_t_17 = __pyx_v_k;
17938  __pyx_t_18 = 1;
17939  __pyx_t_9 = -1;
17940  if (__pyx_t_16 < 0) {
17941  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[0].shape;
17942  if (unlikely(__pyx_t_16 < 0)) __pyx_t_9 = 0;
17943  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_9 = 0;
17944  if (__pyx_t_17 < 0) {
17945  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[1].shape;
17946  if (unlikely(__pyx_t_17 < 0)) __pyx_t_9 = 1;
17947  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_9 = 1;
17948  if (__pyx_t_18 < 0) {
17949  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[2].shape;
17950  if (unlikely(__pyx_t_18 < 0)) __pyx_t_9 = 2;
17951  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_9 = 2;
17952  if (unlikely(__pyx_t_9 != -1)) {
17953  __Pyx_RaiseBufferIndexError(__pyx_t_9);
17954  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17955  }
17956  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_15, __pyx_pybuffernd_x.diminfo[2].strides))));
17957 
17958  /* "subsurfaceTransportFunctions.pyx":875
17959  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17960  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17961  * v[eN,k,2]=zVelocity # <<<<<<<<<<<<<<
17962  * v[eN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
17963  * else:
17964  */
17965  __pyx_t_19 = __pyx_v_eN;
17966  __pyx_t_20 = __pyx_v_k;
17967  __pyx_t_21 = 2;
17968  __pyx_t_9 = -1;
17969  if (__pyx_t_19 < 0) {
17970  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[0].shape;
17971  if (unlikely(__pyx_t_19 < 0)) __pyx_t_9 = 0;
17972  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_9 = 0;
17973  if (__pyx_t_20 < 0) {
17974  __pyx_t_20 += __pyx_pybuffernd_v.diminfo[1].shape;
17975  if (unlikely(__pyx_t_20 < 0)) __pyx_t_9 = 1;
17976  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_9 = 1;
17977  if (__pyx_t_21 < 0) {
17978  __pyx_t_21 += __pyx_pybuffernd_v.diminfo[2].shape;
17979  if (unlikely(__pyx_t_21 < 0)) __pyx_t_9 = 2;
17980  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_9 = 2;
17981  if (unlikely(__pyx_t_9 != -1)) {
17982  __Pyx_RaiseBufferIndexError(__pyx_t_9);
17983  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17984  }
17985  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_21, __pyx_pybuffernd_v.diminfo[2].strides) = __pyx_v_zVelocity;
17986 
17987  /* "subsurfaceTransportFunctions.pyx":876
17988  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17989  * v[eN,k,2]=zVelocity
17990  * v[eN,k,:]*=clock*cos(pi*t/(tForReversal*2.0)) # <<<<<<<<<<<<<<
17991  * else:
17992  * for eN in range(x.shape[0]):
17993  */
17994  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17995  __Pyx_GOTREF(__pyx_t_22);
17996  __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17997  __Pyx_GOTREF(__pyx_t_23);
17998  __pyx_t_24 = PyTuple_New(3); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17999  __Pyx_GOTREF(__pyx_t_24);
18000  __Pyx_GIVEREF(__pyx_t_22);
18001  PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_22);
18002  __Pyx_GIVEREF(__pyx_t_23);
18003  PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_t_23);
18004  __Pyx_INCREF(__pyx_slice__7);
18005  __Pyx_GIVEREF(__pyx_slice__7);
18006  PyTuple_SET_ITEM(__pyx_t_24, 2, __pyx_slice__7);
18007  __pyx_t_22 = 0;
18008  __pyx_t_23 = 0;
18009  __pyx_t_23 = PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_24); if (unlikely(__pyx_t_23 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
18010  __Pyx_GOTREF(__pyx_t_23);
18011  __pyx_t_25 = (__pyx_v_pi * __pyx_v_t);
18012  __pyx_t_26 = (__pyx_v_tForReversal * 2.0);
18013  if (unlikely(__pyx_t_26 == 0)) {
18014  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
18015  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18016  }
18017  __pyx_t_22 = PyFloat_FromDouble((__pyx_v_clock * cos((__pyx_t_25 / __pyx_t_26)))); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18018  __Pyx_GOTREF(__pyx_t_22);
18019  __pyx_t_27 = PyNumber_InPlaceMultiply(__pyx_t_23, __pyx_t_22); if (unlikely(!__pyx_t_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18020  __Pyx_GOTREF(__pyx_t_27);
18021  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
18022  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
18023  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_24, __pyx_t_27) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18024  __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
18025  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
18026  }
18027  }
18028 
18029  /* "subsurfaceTransportFunctions.pyx":870
18030  * cdef double pi
18031  * pi = M_PI
18032  * if transient == 1: # <<<<<<<<<<<<<<
18033  * for eN in range(x.shape[0]):
18034  * for k in range(x.shape[1]):
18035  */
18036  goto __pyx_L3;
18037  }
18038 
18039  /* "subsurfaceTransportFunctions.pyx":878
18040  * v[eN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
18041  * else:
18042  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
18043  * for k in range(x.shape[1]):
18044  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
18045  */
18046  /*else*/ {
18047  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
18048  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
18049  __pyx_v_eN = __pyx_t_3;
18050 
18051  /* "subsurfaceTransportFunctions.pyx":879
18052  * else:
18053  * for eN in range(x.shape[0]):
18054  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
18055  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
18056  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
18057  */
18058  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
18059  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
18060  __pyx_v_k = __pyx_t_5;
18061 
18062  /* "subsurfaceTransportFunctions.pyx":880
18063  * for eN in range(x.shape[0]):
18064  * for k in range(x.shape[1]):
18065  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
18066  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
18067  * v[eN,k,2]=zVelocity
18068  */
18069  __pyx_t_28 = __pyx_v_eN;
18070  __pyx_t_29 = __pyx_v_k;
18071  __pyx_t_30 = 1;
18072  __pyx_t_9 = -1;
18073  if (__pyx_t_28 < 0) {
18074  __pyx_t_28 += __pyx_pybuffernd_x.diminfo[0].shape;
18075  if (unlikely(__pyx_t_28 < 0)) __pyx_t_9 = 0;
18076  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_9 = 0;
18077  if (__pyx_t_29 < 0) {
18078  __pyx_t_29 += __pyx_pybuffernd_x.diminfo[1].shape;
18079  if (unlikely(__pyx_t_29 < 0)) __pyx_t_9 = 1;
18080  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_9 = 1;
18081  if (__pyx_t_30 < 0) {
18082  __pyx_t_30 += __pyx_pybuffernd_x.diminfo[2].shape;
18083  if (unlikely(__pyx_t_30 < 0)) __pyx_t_9 = 2;
18084  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_9 = 2;
18085  if (unlikely(__pyx_t_9 != -1)) {
18086  __Pyx_RaiseBufferIndexError(__pyx_t_9);
18087  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18088  }
18089  __pyx_t_31 = __pyx_v_eN;
18090  __pyx_t_32 = __pyx_v_k;
18091  __pyx_t_33 = 0;
18092  __pyx_t_9 = -1;
18093  if (__pyx_t_31 < 0) {
18094  __pyx_t_31 += __pyx_pybuffernd_v.diminfo[0].shape;
18095  if (unlikely(__pyx_t_31 < 0)) __pyx_t_9 = 0;
18096  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_9 = 0;
18097  if (__pyx_t_32 < 0) {
18098  __pyx_t_32 += __pyx_pybuffernd_v.diminfo[1].shape;
18099  if (unlikely(__pyx_t_32 < 0)) __pyx_t_9 = 1;
18100  } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_9 = 1;
18101  if (__pyx_t_33 < 0) {
18102  __pyx_t_33 += __pyx_pybuffernd_v.diminfo[2].shape;
18103  if (unlikely(__pyx_t_33 < 0)) __pyx_t_9 = 2;
18104  } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_9 = 2;
18105  if (unlikely(__pyx_t_9 != -1)) {
18106  __Pyx_RaiseBufferIndexError(__pyx_t_9);
18107  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18108  }
18109  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_33, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_30, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
18110 
18111  /* "subsurfaceTransportFunctions.pyx":881
18112  * for k in range(x.shape[1]):
18113  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
18114  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
18115  * v[eN,k,2]=zVelocity
18116  *
18117  */
18118  __pyx_t_34 = __pyx_v_eN;
18119  __pyx_t_35 = __pyx_v_k;
18120  __pyx_t_36 = 0;
18121  __pyx_t_9 = -1;
18122  if (__pyx_t_34 < 0) {
18123  __pyx_t_34 += __pyx_pybuffernd_x.diminfo[0].shape;
18124  if (unlikely(__pyx_t_34 < 0)) __pyx_t_9 = 0;
18125  } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_9 = 0;
18126  if (__pyx_t_35 < 0) {
18127  __pyx_t_35 += __pyx_pybuffernd_x.diminfo[1].shape;
18128  if (unlikely(__pyx_t_35 < 0)) __pyx_t_9 = 1;
18129  } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_9 = 1;
18130  if (__pyx_t_36 < 0) {
18131  __pyx_t_36 += __pyx_pybuffernd_x.diminfo[2].shape;
18132  if (unlikely(__pyx_t_36 < 0)) __pyx_t_9 = 2;
18133  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_9 = 2;
18134  if (unlikely(__pyx_t_9 != -1)) {
18135  __Pyx_RaiseBufferIndexError(__pyx_t_9);
18136  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18137  }
18138  __pyx_t_37 = __pyx_v_eN;
18139  __pyx_t_38 = __pyx_v_k;
18140  __pyx_t_39 = 1;
18141  __pyx_t_9 = -1;
18142  if (__pyx_t_37 < 0) {
18143  __pyx_t_37 += __pyx_pybuffernd_v.diminfo[0].shape;
18144  if (unlikely(__pyx_t_37 < 0)) __pyx_t_9 = 0;
18145  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_9 = 0;
18146  if (__pyx_t_38 < 0) {
18147  __pyx_t_38 += __pyx_pybuffernd_v.diminfo[1].shape;
18148  if (unlikely(__pyx_t_38 < 0)) __pyx_t_9 = 1;
18149  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_9 = 1;
18150  if (__pyx_t_39 < 0) {
18151  __pyx_t_39 += __pyx_pybuffernd_v.diminfo[2].shape;
18152  if (unlikely(__pyx_t_39 < 0)) __pyx_t_9 = 2;
18153  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_9 = 2;
18154  if (unlikely(__pyx_t_9 != -1)) {
18155  __Pyx_RaiseBufferIndexError(__pyx_t_9);
18156  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18157  }
18158  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_39, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_36, __pyx_pybuffernd_x.diminfo[2].strides))));
18159 
18160  /* "subsurfaceTransportFunctions.pyx":882
18161  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
18162  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
18163  * v[eN,k,2]=zVelocity # <<<<<<<<<<<<<<
18164  *
18165  * def helicalElementVelocityEval4(int transient,
18166  */
18167  __pyx_t_40 = __pyx_v_eN;
18168  __pyx_t_41 = __pyx_v_k;
18169  __pyx_t_42 = 2;
18170  __pyx_t_9 = -1;
18171  if (__pyx_t_40 < 0) {
18172  __pyx_t_40 += __pyx_pybuffernd_v.diminfo[0].shape;
18173  if (unlikely(__pyx_t_40 < 0)) __pyx_t_9 = 0;
18174  } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_9 = 0;
18175  if (__pyx_t_41 < 0) {
18176  __pyx_t_41 += __pyx_pybuffernd_v.diminfo[1].shape;
18177  if (unlikely(__pyx_t_41 < 0)) __pyx_t_9 = 1;
18178  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_9 = 1;
18179  if (__pyx_t_42 < 0) {
18180  __pyx_t_42 += __pyx_pybuffernd_v.diminfo[2].shape;
18181  if (unlikely(__pyx_t_42 < 0)) __pyx_t_9 = 2;
18182  } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_9 = 2;
18183  if (unlikely(__pyx_t_9 != -1)) {
18184  __Pyx_RaiseBufferIndexError(__pyx_t_9);
18185  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18186  }
18187  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_41, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_42, __pyx_pybuffernd_v.diminfo[2].strides) = __pyx_v_zVelocity;
18188  }
18189  }
18190  }
18191  __pyx_L3:;
18192 
18193  /* "subsurfaceTransportFunctions.pyx":859
18194  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18195  *
18196  * def helicalElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
18197  * double t,
18198  * double tForReversal,
18199  */
18200 
18201  /* function exit code */
18202  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
18203  goto __pyx_L0;
18204  __pyx_L1_error:;
18205  __Pyx_XDECREF(__pyx_t_22);
18206  __Pyx_XDECREF(__pyx_t_23);
18207  __Pyx_XDECREF(__pyx_t_24);
18208  __Pyx_XDECREF(__pyx_t_27);
18209  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
18210  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
18211  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
18212  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
18213  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
18214  __Pyx_AddTraceback("subsurfaceTransportFunctions.helicalElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
18215  __pyx_r = NULL;
18216  goto __pyx_L2;
18217  __pyx_L0:;
18218  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
18219  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
18220  __pyx_L2:;
18221  __Pyx_XGIVEREF(__pyx_r);
18222  __Pyx_RefNannyFinishContext();
18223  return __pyx_r;
18224 }
18225 
18226 /* "subsurfaceTransportFunctions.pyx":884
18227  * v[eN,k,2]=zVelocity
18228  *
18229  * def helicalElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
18230  * double t,
18231  * double tForReversal,
18232  */
18233 
18234 /* Python wrapper */
18235 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_53helicalElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
18236 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_53helicalElementVelocityEval4 = {"helicalElementVelocityEval4", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_53helicalElementVelocityEval4, METH_VARARGS|METH_KEYWORDS, 0};
18237 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_53helicalElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
18238  int __pyx_v_transient;
18239  double __pyx_v_t;
18240  double __pyx_v_tForReversal;
18241  double __pyx_v_clock;
18242  double __pyx_v_zVelocity;
18243  double __pyx_v_xc;
18244  double __pyx_v_yc;
18245  PyArrayObject *__pyx_v_x = 0;
18246  PyArrayObject *__pyx_v_v = 0;
18247  int __pyx_lineno = 0;
18248  const char *__pyx_filename = NULL;
18249  int __pyx_clineno = 0;
18250  PyObject *__pyx_r = 0;
18251  __Pyx_RefNannyDeclarations
18252  __Pyx_RefNannySetupContext("helicalElementVelocityEval4 (wrapper)", 0);
18253  {
18254  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_transient,&__pyx_n_s_t,&__pyx_n_s_tForReversal,&__pyx_n_s_clock,&__pyx_n_s_zVelocity,&__pyx_n_s_xc,&__pyx_n_s_yc,&__pyx_n_s_x,&__pyx_n_s_v,0};
18255  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
18256  if (unlikely(__pyx_kwds)) {
18257  Py_ssize_t kw_args;
18258  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
18259  switch (pos_args) {
18260  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
18261  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
18262  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
18263  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
18264  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
18265  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
18266  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
18267  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
18268  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
18269  case 0: break;
18270  default: goto __pyx_L5_argtuple_error;
18271  }
18272  kw_args = PyDict_Size(__pyx_kwds);
18273  switch (pos_args) {
18274  case 0:
18275  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_transient)) != 0)) kw_args--;
18276  else goto __pyx_L5_argtuple_error;
18277  case 1:
18278  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
18279  else {
18280  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
18281  }
18282  case 2:
18283  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tForReversal)) != 0)) kw_args--;
18284  else {
18285  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
18286  }
18287  case 3:
18288  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_clock)) != 0)) kw_args--;
18289  else {
18290  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
18291  }
18292  case 4:
18293  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_zVelocity)) != 0)) kw_args--;
18294  else {
18295  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
18296  }
18297  case 5:
18298  if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_xc)) != 0)) kw_args--;
18299  else {
18300  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
18301  }
18302  case 6:
18303  if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_yc)) != 0)) kw_args--;
18304  else {
18305  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
18306  }
18307  case 7:
18308  if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
18309  else {
18310  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
18311  }
18312  case 8:
18313  if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
18314  else {
18315  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
18316  }
18317  }
18318  if (unlikely(kw_args > 0)) {
18319  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "helicalElementVelocityEval4") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
18320  }
18321  } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
18322  goto __pyx_L5_argtuple_error;
18323  } else {
18324  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
18325  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
18326  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
18327  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
18328  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
18329  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
18330  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
18331  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
18332  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
18333  }
18334  __pyx_v_transient = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_transient == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
18335  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
18336  __pyx_v_tForReversal = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tForReversal == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
18337  __pyx_v_clock = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_clock == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
18338  __pyx_v_zVelocity = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_zVelocity == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
18339  __pyx_v_xc = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_xc == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
18340  __pyx_v_yc = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_yc == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
18341  __pyx_v_x = ((PyArrayObject *)values[7]);
18342  __pyx_v_v = ((PyArrayObject *)values[8]);
18343  }
18344  goto __pyx_L4_argument_unpacking_done;
18345  __pyx_L5_argtuple_error:;
18346  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
18347  __pyx_L3_error:;
18348  __Pyx_AddTraceback("subsurfaceTransportFunctions.helicalElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
18349  __Pyx_RefNannyFinishContext();
18350  return NULL;
18351  __pyx_L4_argument_unpacking_done:;
18352  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18353  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18354  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_52helicalElementVelocityEval4(__pyx_self, __pyx_v_transient, __pyx_v_t, __pyx_v_tForReversal, __pyx_v_clock, __pyx_v_zVelocity, __pyx_v_xc, __pyx_v_yc, __pyx_v_x, __pyx_v_v);
18355 
18356  /* function exit code */
18357  goto __pyx_L0;
18358  __pyx_L1_error:;
18359  __pyx_r = NULL;
18360  __pyx_L0:;
18361  __Pyx_RefNannyFinishContext();
18362  return __pyx_r;
18363 }
18364 
18365 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_52helicalElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_zVelocity, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v) {
18366  int __pyx_v_eN;
18367  int __pyx_v_ebN;
18368  int __pyx_v_k;
18369  double __pyx_v_pi;
18370  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
18371  __Pyx_Buffer __pyx_pybuffer_v;
18372  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
18373  __Pyx_Buffer __pyx_pybuffer_x;
18374  PyObject *__pyx_r = NULL;
18375  __Pyx_RefNannyDeclarations
18376  int __pyx_t_1;
18377  npy_intp __pyx_t_2;
18378  int __pyx_t_3;
18379  npy_intp __pyx_t_4;
18380  int __pyx_t_5;
18381  npy_intp __pyx_t_6;
18382  int __pyx_t_7;
18383  Py_ssize_t __pyx_t_8;
18384  Py_ssize_t __pyx_t_9;
18385  Py_ssize_t __pyx_t_10;
18386  Py_ssize_t __pyx_t_11;
18387  int __pyx_t_12;
18388  Py_ssize_t __pyx_t_13;
18389  Py_ssize_t __pyx_t_14;
18390  Py_ssize_t __pyx_t_15;
18391  Py_ssize_t __pyx_t_16;
18392  Py_ssize_t __pyx_t_17;
18393  Py_ssize_t __pyx_t_18;
18394  Py_ssize_t __pyx_t_19;
18395  Py_ssize_t __pyx_t_20;
18396  Py_ssize_t __pyx_t_21;
18397  Py_ssize_t __pyx_t_22;
18398  Py_ssize_t __pyx_t_23;
18399  Py_ssize_t __pyx_t_24;
18400  Py_ssize_t __pyx_t_25;
18401  Py_ssize_t __pyx_t_26;
18402  Py_ssize_t __pyx_t_27;
18403  Py_ssize_t __pyx_t_28;
18404  PyObject *__pyx_t_29 = NULL;
18405  PyObject *__pyx_t_30 = NULL;
18406  PyObject *__pyx_t_31 = NULL;
18407  PyObject *__pyx_t_32 = NULL;
18408  double __pyx_t_33;
18409  double __pyx_t_34;
18410  Py_ssize_t __pyx_t_35;
18411  Py_ssize_t __pyx_t_36;
18412  Py_ssize_t __pyx_t_37;
18413  Py_ssize_t __pyx_t_38;
18414  Py_ssize_t __pyx_t_39;
18415  Py_ssize_t __pyx_t_40;
18416  Py_ssize_t __pyx_t_41;
18417  Py_ssize_t __pyx_t_42;
18418  Py_ssize_t __pyx_t_43;
18419  Py_ssize_t __pyx_t_44;
18420  Py_ssize_t __pyx_t_45;
18421  Py_ssize_t __pyx_t_46;
18422  Py_ssize_t __pyx_t_47;
18423  Py_ssize_t __pyx_t_48;
18424  Py_ssize_t __pyx_t_49;
18425  Py_ssize_t __pyx_t_50;
18426  Py_ssize_t __pyx_t_51;
18427  Py_ssize_t __pyx_t_52;
18428  Py_ssize_t __pyx_t_53;
18429  Py_ssize_t __pyx_t_54;
18430  int __pyx_lineno = 0;
18431  const char *__pyx_filename = NULL;
18432  int __pyx_clineno = 0;
18433  __Pyx_RefNannySetupContext("helicalElementVelocityEval4", 0);
18434  __pyx_pybuffer_x.pybuffer.buf = NULL;
18435  __pyx_pybuffer_x.refcount = 0;
18436  __pyx_pybuffernd_x.data = NULL;
18437  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
18438  __pyx_pybuffer_v.pybuffer.buf = NULL;
18439  __pyx_pybuffer_v.refcount = 0;
18440  __pyx_pybuffernd_v.data = NULL;
18441  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
18442  {
18443  __Pyx_BufFmt_StackElem __pyx_stack[1];
18444  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18445  }
18446  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
18447  {
18448  __Pyx_BufFmt_StackElem __pyx_stack[1];
18449  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18450  }
18451  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_v.diminfo[3].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_v.diminfo[3].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[3];
18452 
18453  /* "subsurfaceTransportFunctions.pyx":894
18454  * cdef int eN,ebN,k
18455  * cdef double pi
18456  * pi = M_PI # <<<<<<<<<<<<<<
18457  * if transient == 1:
18458  * for eN in range(x.shape[0]):
18459  */
18460  __pyx_v_pi = M_PI;
18461 
18462  /* "subsurfaceTransportFunctions.pyx":895
18463  * cdef double pi
18464  * pi = M_PI
18465  * if transient == 1: # <<<<<<<<<<<<<<
18466  * for eN in range(x.shape[0]):
18467  * for ebN in range(x.shape[1]):
18468  */
18469  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
18470  if (__pyx_t_1) {
18471 
18472  /* "subsurfaceTransportFunctions.pyx":896
18473  * pi = M_PI
18474  * if transient == 1:
18475  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
18476  * for ebN in range(x.shape[1]):
18477  * for k in range(x.shape[2]):
18478  */
18479  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
18480  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
18481  __pyx_v_eN = __pyx_t_3;
18482 
18483  /* "subsurfaceTransportFunctions.pyx":897
18484  * if transient == 1:
18485  * for eN in range(x.shape[0]):
18486  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
18487  * for k in range(x.shape[2]):
18488  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18489  */
18490  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
18491  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
18492  __pyx_v_ebN = __pyx_t_5;
18493 
18494  /* "subsurfaceTransportFunctions.pyx":898
18495  * for eN in range(x.shape[0]):
18496  * for ebN in range(x.shape[1]):
18497  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
18498  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18499  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18500  */
18501  __pyx_t_6 = (__pyx_v_x->dimensions[2]);
18502  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
18503  __pyx_v_k = __pyx_t_7;
18504 
18505  /* "subsurfaceTransportFunctions.pyx":899
18506  * for ebN in range(x.shape[1]):
18507  * for k in range(x.shape[2]):
18508  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
18509  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18510  * v[eN,ebN,k,2]=zVelocity
18511  */
18512  __pyx_t_8 = __pyx_v_eN;
18513  __pyx_t_9 = __pyx_v_ebN;
18514  __pyx_t_10 = __pyx_v_k;
18515  __pyx_t_11 = 1;
18516  __pyx_t_12 = -1;
18517  if (__pyx_t_8 < 0) {
18518  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[0].shape;
18519  if (unlikely(__pyx_t_8 < 0)) __pyx_t_12 = 0;
18520  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_12 = 0;
18521  if (__pyx_t_9 < 0) {
18522  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
18523  if (unlikely(__pyx_t_9 < 0)) __pyx_t_12 = 1;
18524  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_12 = 1;
18525  if (__pyx_t_10 < 0) {
18526  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[2].shape;
18527  if (unlikely(__pyx_t_10 < 0)) __pyx_t_12 = 2;
18528  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_12 = 2;
18529  if (__pyx_t_11 < 0) {
18530  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[3].shape;
18531  if (unlikely(__pyx_t_11 < 0)) __pyx_t_12 = 3;
18532  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_12 = 3;
18533  if (unlikely(__pyx_t_12 != -1)) {
18534  __Pyx_RaiseBufferIndexError(__pyx_t_12);
18535  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18536  }
18537  __pyx_t_13 = __pyx_v_eN;
18538  __pyx_t_14 = __pyx_v_ebN;
18539  __pyx_t_15 = __pyx_v_k;
18540  __pyx_t_16 = 0;
18541  __pyx_t_12 = -1;
18542  if (__pyx_t_13 < 0) {
18543  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[0].shape;
18544  if (unlikely(__pyx_t_13 < 0)) __pyx_t_12 = 0;
18545  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_12 = 0;
18546  if (__pyx_t_14 < 0) {
18547  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[1].shape;
18548  if (unlikely(__pyx_t_14 < 0)) __pyx_t_12 = 1;
18549  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_12 = 1;
18550  if (__pyx_t_15 < 0) {
18551  __pyx_t_15 += __pyx_pybuffernd_v.diminfo[2].shape;
18552  if (unlikely(__pyx_t_15 < 0)) __pyx_t_12 = 2;
18553  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_12 = 2;
18554  if (__pyx_t_16 < 0) {
18555  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[3].shape;
18556  if (unlikely(__pyx_t_16 < 0)) __pyx_t_12 = 3;
18557  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_12 = 3;
18558  if (unlikely(__pyx_t_12 != -1)) {
18559  __Pyx_RaiseBufferIndexError(__pyx_t_12);
18560  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18561  }
18562  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_15, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_16, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
18563 
18564  /* "subsurfaceTransportFunctions.pyx":900
18565  * for k in range(x.shape[2]):
18566  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18567  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
18568  * v[eN,ebN,k,2]=zVelocity
18569  * v[eN,ebN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
18570  */
18571  __pyx_t_17 = __pyx_v_eN;
18572  __pyx_t_18 = __pyx_v_ebN;
18573  __pyx_t_19 = __pyx_v_k;
18574  __pyx_t_20 = 0;
18575  __pyx_t_12 = -1;
18576  if (__pyx_t_17 < 0) {
18577  __pyx_t_17 += __pyx_pybuffernd_x.diminfo[0].shape;
18578  if (unlikely(__pyx_t_17 < 0)) __pyx_t_12 = 0;
18579  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_12 = 0;
18580  if (__pyx_t_18 < 0) {
18581  __pyx_t_18 += __pyx_pybuffernd_x.diminfo[1].shape;
18582  if (unlikely(__pyx_t_18 < 0)) __pyx_t_12 = 1;
18583  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_12 = 1;
18584  if (__pyx_t_19 < 0) {
18585  __pyx_t_19 += __pyx_pybuffernd_x.diminfo[2].shape;
18586  if (unlikely(__pyx_t_19 < 0)) __pyx_t_12 = 2;
18587  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_12 = 2;
18588  if (__pyx_t_20 < 0) {
18589  __pyx_t_20 += __pyx_pybuffernd_x.diminfo[3].shape;
18590  if (unlikely(__pyx_t_20 < 0)) __pyx_t_12 = 3;
18591  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_12 = 3;
18592  if (unlikely(__pyx_t_12 != -1)) {
18593  __Pyx_RaiseBufferIndexError(__pyx_t_12);
18594  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18595  }
18596  __pyx_t_21 = __pyx_v_eN;
18597  __pyx_t_22 = __pyx_v_ebN;
18598  __pyx_t_23 = __pyx_v_k;
18599  __pyx_t_24 = 1;
18600  __pyx_t_12 = -1;
18601  if (__pyx_t_21 < 0) {
18602  __pyx_t_21 += __pyx_pybuffernd_v.diminfo[0].shape;
18603  if (unlikely(__pyx_t_21 < 0)) __pyx_t_12 = 0;
18604  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_12 = 0;
18605  if (__pyx_t_22 < 0) {
18606  __pyx_t_22 += __pyx_pybuffernd_v.diminfo[1].shape;
18607  if (unlikely(__pyx_t_22 < 0)) __pyx_t_12 = 1;
18608  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_12 = 1;
18609  if (__pyx_t_23 < 0) {
18610  __pyx_t_23 += __pyx_pybuffernd_v.diminfo[2].shape;
18611  if (unlikely(__pyx_t_23 < 0)) __pyx_t_12 = 2;
18612  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_12 = 2;
18613  if (__pyx_t_24 < 0) {
18614  __pyx_t_24 += __pyx_pybuffernd_v.diminfo[3].shape;
18615  if (unlikely(__pyx_t_24 < 0)) __pyx_t_12 = 3;
18616  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_12 = 3;
18617  if (unlikely(__pyx_t_12 != -1)) {
18618  __Pyx_RaiseBufferIndexError(__pyx_t_12);
18619  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18620  }
18621  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_23, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_24, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_19, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_20, __pyx_pybuffernd_x.diminfo[3].strides))));
18622 
18623  /* "subsurfaceTransportFunctions.pyx":901
18624  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18625  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18626  * v[eN,ebN,k,2]=zVelocity # <<<<<<<<<<<<<<
18627  * v[eN,ebN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
18628  * else:
18629  */
18630  __pyx_t_25 = __pyx_v_eN;
18631  __pyx_t_26 = __pyx_v_ebN;
18632  __pyx_t_27 = __pyx_v_k;
18633  __pyx_t_28 = 2;
18634  __pyx_t_12 = -1;
18635  if (__pyx_t_25 < 0) {
18636  __pyx_t_25 += __pyx_pybuffernd_v.diminfo[0].shape;
18637  if (unlikely(__pyx_t_25 < 0)) __pyx_t_12 = 0;
18638  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_12 = 0;
18639  if (__pyx_t_26 < 0) {
18640  __pyx_t_26 += __pyx_pybuffernd_v.diminfo[1].shape;
18641  if (unlikely(__pyx_t_26 < 0)) __pyx_t_12 = 1;
18642  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_12 = 1;
18643  if (__pyx_t_27 < 0) {
18644  __pyx_t_27 += __pyx_pybuffernd_v.diminfo[2].shape;
18645  if (unlikely(__pyx_t_27 < 0)) __pyx_t_12 = 2;
18646  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_12 = 2;
18647  if (__pyx_t_28 < 0) {
18648  __pyx_t_28 += __pyx_pybuffernd_v.diminfo[3].shape;
18649  if (unlikely(__pyx_t_28 < 0)) __pyx_t_12 = 3;
18650  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_12 = 3;
18651  if (unlikely(__pyx_t_12 != -1)) {
18652  __Pyx_RaiseBufferIndexError(__pyx_t_12);
18653  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18654  }
18655  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_27, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_28, __pyx_pybuffernd_v.diminfo[3].strides) = __pyx_v_zVelocity;
18656 
18657  /* "subsurfaceTransportFunctions.pyx":902
18658  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18659  * v[eN,ebN,k,2]=zVelocity
18660  * v[eN,ebN,k,:]*=clock*cos(pi*t/(tForReversal*2.0)) # <<<<<<<<<<<<<<
18661  * else:
18662  * for eN in range(x.shape[0]):
18663  */
18664  __pyx_t_29 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18665  __Pyx_GOTREF(__pyx_t_29);
18666  __pyx_t_30 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18667  __Pyx_GOTREF(__pyx_t_30);
18668  __pyx_t_31 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18669  __Pyx_GOTREF(__pyx_t_31);
18670  __pyx_t_32 = PyTuple_New(4); if (unlikely(!__pyx_t_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18671  __Pyx_GOTREF(__pyx_t_32);
18672  __Pyx_GIVEREF(__pyx_t_29);
18673  PyTuple_SET_ITEM(__pyx_t_32, 0, __pyx_t_29);
18674  __Pyx_GIVEREF(__pyx_t_30);
18675  PyTuple_SET_ITEM(__pyx_t_32, 1, __pyx_t_30);
18676  __Pyx_GIVEREF(__pyx_t_31);
18677  PyTuple_SET_ITEM(__pyx_t_32, 2, __pyx_t_31);
18678  __Pyx_INCREF(__pyx_slice__8);
18679  __Pyx_GIVEREF(__pyx_slice__8);
18680  PyTuple_SET_ITEM(__pyx_t_32, 3, __pyx_slice__8);
18681  __pyx_t_29 = 0;
18682  __pyx_t_30 = 0;
18683  __pyx_t_31 = 0;
18684  __pyx_t_31 = PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_32); if (unlikely(__pyx_t_31 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
18685  __Pyx_GOTREF(__pyx_t_31);
18686  __pyx_t_33 = (__pyx_v_pi * __pyx_v_t);
18687  __pyx_t_34 = (__pyx_v_tForReversal * 2.0);
18688  if (unlikely(__pyx_t_34 == 0)) {
18689  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
18690  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18691  }
18692  __pyx_t_30 = PyFloat_FromDouble((__pyx_v_clock * cos((__pyx_t_33 / __pyx_t_34)))); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18693  __Pyx_GOTREF(__pyx_t_30);
18694  __pyx_t_29 = PyNumber_InPlaceMultiply(__pyx_t_31, __pyx_t_30); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18695  __Pyx_GOTREF(__pyx_t_29);
18696  __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
18697  __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
18698  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_32, __pyx_t_29) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18699  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
18700  __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
18701  }
18702  }
18703  }
18704 
18705  /* "subsurfaceTransportFunctions.pyx":895
18706  * cdef double pi
18707  * pi = M_PI
18708  * if transient == 1: # <<<<<<<<<<<<<<
18709  * for eN in range(x.shape[0]):
18710  * for ebN in range(x.shape[1]):
18711  */
18712  goto __pyx_L3;
18713  }
18714 
18715  /* "subsurfaceTransportFunctions.pyx":904
18716  * v[eN,ebN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
18717  * else:
18718  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
18719  * for ebN in range(x.shape[1]):
18720  * for k in range(x.shape[2]):
18721  */
18722  /*else*/ {
18723  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
18724  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
18725  __pyx_v_eN = __pyx_t_3;
18726 
18727  /* "subsurfaceTransportFunctions.pyx":905
18728  * else:
18729  * for eN in range(x.shape[0]):
18730  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
18731  * for k in range(x.shape[2]):
18732  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18733  */
18734  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
18735  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
18736  __pyx_v_ebN = __pyx_t_5;
18737 
18738  /* "subsurfaceTransportFunctions.pyx":906
18739  * for eN in range(x.shape[0]):
18740  * for ebN in range(x.shape[1]):
18741  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
18742  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18743  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18744  */
18745  __pyx_t_6 = (__pyx_v_x->dimensions[2]);
18746  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
18747  __pyx_v_k = __pyx_t_7;
18748 
18749  /* "subsurfaceTransportFunctions.pyx":907
18750  * for ebN in range(x.shape[1]):
18751  * for k in range(x.shape[2]):
18752  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
18753  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18754  * v[eN,ebN,k,2]=zVelocity
18755  */
18756  __pyx_t_35 = __pyx_v_eN;
18757  __pyx_t_36 = __pyx_v_ebN;
18758  __pyx_t_37 = __pyx_v_k;
18759  __pyx_t_38 = 1;
18760  __pyx_t_12 = -1;
18761  if (__pyx_t_35 < 0) {
18762  __pyx_t_35 += __pyx_pybuffernd_x.diminfo[0].shape;
18763  if (unlikely(__pyx_t_35 < 0)) __pyx_t_12 = 0;
18764  } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_12 = 0;
18765  if (__pyx_t_36 < 0) {
18766  __pyx_t_36 += __pyx_pybuffernd_x.diminfo[1].shape;
18767  if (unlikely(__pyx_t_36 < 0)) __pyx_t_12 = 1;
18768  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_12 = 1;
18769  if (__pyx_t_37 < 0) {
18770  __pyx_t_37 += __pyx_pybuffernd_x.diminfo[2].shape;
18771  if (unlikely(__pyx_t_37 < 0)) __pyx_t_12 = 2;
18772  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_12 = 2;
18773  if (__pyx_t_38 < 0) {
18774  __pyx_t_38 += __pyx_pybuffernd_x.diminfo[3].shape;
18775  if (unlikely(__pyx_t_38 < 0)) __pyx_t_12 = 3;
18776  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_12 = 3;
18777  if (unlikely(__pyx_t_12 != -1)) {
18778  __Pyx_RaiseBufferIndexError(__pyx_t_12);
18779  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18780  }
18781  __pyx_t_39 = __pyx_v_eN;
18782  __pyx_t_40 = __pyx_v_ebN;
18783  __pyx_t_41 = __pyx_v_k;
18784  __pyx_t_42 = 0;
18785  __pyx_t_12 = -1;
18786  if (__pyx_t_39 < 0) {
18787  __pyx_t_39 += __pyx_pybuffernd_v.diminfo[0].shape;
18788  if (unlikely(__pyx_t_39 < 0)) __pyx_t_12 = 0;
18789  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_12 = 0;
18790  if (__pyx_t_40 < 0) {
18791  __pyx_t_40 += __pyx_pybuffernd_v.diminfo[1].shape;
18792  if (unlikely(__pyx_t_40 < 0)) __pyx_t_12 = 1;
18793  } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_12 = 1;
18794  if (__pyx_t_41 < 0) {
18795  __pyx_t_41 += __pyx_pybuffernd_v.diminfo[2].shape;
18796  if (unlikely(__pyx_t_41 < 0)) __pyx_t_12 = 2;
18797  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_12 = 2;
18798  if (__pyx_t_42 < 0) {
18799  __pyx_t_42 += __pyx_pybuffernd_v.diminfo[3].shape;
18800  if (unlikely(__pyx_t_42 < 0)) __pyx_t_12 = 3;
18801  } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_12 = 3;
18802  if (unlikely(__pyx_t_12 != -1)) {
18803  __Pyx_RaiseBufferIndexError(__pyx_t_12);
18804  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18805  }
18806  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_40, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_41, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_42, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_36, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_37, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_38, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
18807 
18808  /* "subsurfaceTransportFunctions.pyx":908
18809  * for k in range(x.shape[2]):
18810  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18811  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
18812  * v[eN,ebN,k,2]=zVelocity
18813  *
18814  */
18815  __pyx_t_43 = __pyx_v_eN;
18816  __pyx_t_44 = __pyx_v_ebN;
18817  __pyx_t_45 = __pyx_v_k;
18818  __pyx_t_46 = 0;
18819  __pyx_t_12 = -1;
18820  if (__pyx_t_43 < 0) {
18821  __pyx_t_43 += __pyx_pybuffernd_x.diminfo[0].shape;
18822  if (unlikely(__pyx_t_43 < 0)) __pyx_t_12 = 0;
18823  } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_12 = 0;
18824  if (__pyx_t_44 < 0) {
18825  __pyx_t_44 += __pyx_pybuffernd_x.diminfo[1].shape;
18826  if (unlikely(__pyx_t_44 < 0)) __pyx_t_12 = 1;
18827  } else if (unlikely(__pyx_t_44 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_12 = 1;
18828  if (__pyx_t_45 < 0) {
18829  __pyx_t_45 += __pyx_pybuffernd_x.diminfo[2].shape;
18830  if (unlikely(__pyx_t_45 < 0)) __pyx_t_12 = 2;
18831  } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_12 = 2;
18832  if (__pyx_t_46 < 0) {
18833  __pyx_t_46 += __pyx_pybuffernd_x.diminfo[3].shape;
18834  if (unlikely(__pyx_t_46 < 0)) __pyx_t_12 = 3;
18835  } else if (unlikely(__pyx_t_46 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_12 = 3;
18836  if (unlikely(__pyx_t_12 != -1)) {
18837  __Pyx_RaiseBufferIndexError(__pyx_t_12);
18838  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18839  }
18840  __pyx_t_47 = __pyx_v_eN;
18841  __pyx_t_48 = __pyx_v_ebN;
18842  __pyx_t_49 = __pyx_v_k;
18843  __pyx_t_50 = 1;
18844  __pyx_t_12 = -1;
18845  if (__pyx_t_47 < 0) {
18846  __pyx_t_47 += __pyx_pybuffernd_v.diminfo[0].shape;
18847  if (unlikely(__pyx_t_47 < 0)) __pyx_t_12 = 0;
18848  } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_12 = 0;
18849  if (__pyx_t_48 < 0) {
18850  __pyx_t_48 += __pyx_pybuffernd_v.diminfo[1].shape;
18851  if (unlikely(__pyx_t_48 < 0)) __pyx_t_12 = 1;
18852  } else if (unlikely(__pyx_t_48 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_12 = 1;
18853  if (__pyx_t_49 < 0) {
18854  __pyx_t_49 += __pyx_pybuffernd_v.diminfo[2].shape;
18855  if (unlikely(__pyx_t_49 < 0)) __pyx_t_12 = 2;
18856  } else if (unlikely(__pyx_t_49 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_12 = 2;
18857  if (__pyx_t_50 < 0) {
18858  __pyx_t_50 += __pyx_pybuffernd_v.diminfo[3].shape;
18859  if (unlikely(__pyx_t_50 < 0)) __pyx_t_12 = 3;
18860  } else if (unlikely(__pyx_t_50 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_12 = 3;
18861  if (unlikely(__pyx_t_12 != -1)) {
18862  __Pyx_RaiseBufferIndexError(__pyx_t_12);
18863  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18864  }
18865  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_48, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_49, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_50, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_44, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_45, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_46, __pyx_pybuffernd_x.diminfo[3].strides))));
18866 
18867  /* "subsurfaceTransportFunctions.pyx":909
18868  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18869  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18870  * v[eN,ebN,k,2]=zVelocity # <<<<<<<<<<<<<<
18871  *
18872  * def vortexElementVelocityEval3(double t,
18873  */
18874  __pyx_t_51 = __pyx_v_eN;
18875  __pyx_t_52 = __pyx_v_ebN;
18876  __pyx_t_53 = __pyx_v_k;
18877  __pyx_t_54 = 2;
18878  __pyx_t_12 = -1;
18879  if (__pyx_t_51 < 0) {
18880  __pyx_t_51 += __pyx_pybuffernd_v.diminfo[0].shape;
18881  if (unlikely(__pyx_t_51 < 0)) __pyx_t_12 = 0;
18882  } else if (unlikely(__pyx_t_51 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_12 = 0;
18883  if (__pyx_t_52 < 0) {
18884  __pyx_t_52 += __pyx_pybuffernd_v.diminfo[1].shape;
18885  if (unlikely(__pyx_t_52 < 0)) __pyx_t_12 = 1;
18886  } else if (unlikely(__pyx_t_52 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_12 = 1;
18887  if (__pyx_t_53 < 0) {
18888  __pyx_t_53 += __pyx_pybuffernd_v.diminfo[2].shape;
18889  if (unlikely(__pyx_t_53 < 0)) __pyx_t_12 = 2;
18890  } else if (unlikely(__pyx_t_53 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_12 = 2;
18891  if (__pyx_t_54 < 0) {
18892  __pyx_t_54 += __pyx_pybuffernd_v.diminfo[3].shape;
18893  if (unlikely(__pyx_t_54 < 0)) __pyx_t_12 = 3;
18894  } else if (unlikely(__pyx_t_54 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_12 = 3;
18895  if (unlikely(__pyx_t_12 != -1)) {
18896  __Pyx_RaiseBufferIndexError(__pyx_t_12);
18897  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18898  }
18899  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_52, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_53, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_54, __pyx_pybuffernd_v.diminfo[3].strides) = __pyx_v_zVelocity;
18900  }
18901  }
18902  }
18903  }
18904  __pyx_L3:;
18905 
18906  /* "subsurfaceTransportFunctions.pyx":884
18907  * v[eN,k,2]=zVelocity
18908  *
18909  * def helicalElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
18910  * double t,
18911  * double tForReversal,
18912  */
18913 
18914  /* function exit code */
18915  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
18916  goto __pyx_L0;
18917  __pyx_L1_error:;
18918  __Pyx_XDECREF(__pyx_t_29);
18919  __Pyx_XDECREF(__pyx_t_30);
18920  __Pyx_XDECREF(__pyx_t_31);
18921  __Pyx_XDECREF(__pyx_t_32);
18922  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
18923  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
18924  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
18925  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
18926  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
18927  __Pyx_AddTraceback("subsurfaceTransportFunctions.helicalElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
18928  __pyx_r = NULL;
18929  goto __pyx_L2;
18930  __pyx_L0:;
18931  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
18932  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
18933  __pyx_L2:;
18934  __Pyx_XGIVEREF(__pyx_r);
18935  __Pyx_RefNannyFinishContext();
18936  return __pyx_r;
18937 }
18938 
18939 /* "subsurfaceTransportFunctions.pyx":911
18940  * v[eN,ebN,k,2]=zVelocity
18941  *
18942  * def vortexElementVelocityEval3(double t, # <<<<<<<<<<<<<<
18943  * numpy.ndarray[DTYPE_t,ndim=3] x,
18944  * numpy.ndarray[DTYPE_t,ndim=3] v):
18945  */
18946 
18947 /* Python wrapper */
18948 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_55vortexElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
18949 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_55vortexElementVelocityEval3 = {"vortexElementVelocityEval3", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_55vortexElementVelocityEval3, METH_VARARGS|METH_KEYWORDS, 0};
18950 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_55vortexElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
18951  double __pyx_v_t;
18952  PyArrayObject *__pyx_v_x = 0;
18953  PyArrayObject *__pyx_v_v = 0;
18954  int __pyx_lineno = 0;
18955  const char *__pyx_filename = NULL;
18956  int __pyx_clineno = 0;
18957  PyObject *__pyx_r = 0;
18958  __Pyx_RefNannyDeclarations
18959  __Pyx_RefNannySetupContext("vortexElementVelocityEval3 (wrapper)", 0);
18960  {
18961  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_x,&__pyx_n_s_v,0};
18962  PyObject* values[3] = {0,0,0};
18963  if (unlikely(__pyx_kwds)) {
18964  Py_ssize_t kw_args;
18965  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
18966  switch (pos_args) {
18967  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
18968  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
18969  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
18970  case 0: break;
18971  default: goto __pyx_L5_argtuple_error;
18972  }
18973  kw_args = PyDict_Size(__pyx_kwds);
18974  switch (pos_args) {
18975  case 0:
18976  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
18977  else goto __pyx_L5_argtuple_error;
18978  case 1:
18979  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
18980  else {
18981  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval3", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
18982  }
18983  case 2:
18984  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
18985  else {
18986  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval3", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
18987  }
18988  }
18989  if (unlikely(kw_args > 0)) {
18990  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vortexElementVelocityEval3") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
18991  }
18992  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
18993  goto __pyx_L5_argtuple_error;
18994  } else {
18995  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
18996  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
18997  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
18998  }
18999  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
19000  __pyx_v_x = ((PyArrayObject *)values[1]);
19001  __pyx_v_v = ((PyArrayObject *)values[2]);
19002  }
19003  goto __pyx_L4_argument_unpacking_done;
19004  __pyx_L5_argtuple_error:;
19005  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval3", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
19006  __pyx_L3_error:;
19007  __Pyx_AddTraceback("subsurfaceTransportFunctions.vortexElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
19008  __Pyx_RefNannyFinishContext();
19009  return NULL;
19010  __pyx_L4_argument_unpacking_done:;
19011  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19012  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19013  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_54vortexElementVelocityEval3(__pyx_self, __pyx_v_t, __pyx_v_x, __pyx_v_v);
19014 
19015  /* function exit code */
19016  goto __pyx_L0;
19017  __pyx_L1_error:;
19018  __pyx_r = NULL;
19019  __pyx_L0:;
19020  __Pyx_RefNannyFinishContext();
19021  return __pyx_r;
19022 }
19023 
19024 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_54vortexElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v) {
19025  int __pyx_v_eN;
19026  int __pyx_v_k;
19027  double __pyx_v_pi;
19028  double __pyx_v_one8;
19029  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
19030  __Pyx_Buffer __pyx_pybuffer_v;
19031  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
19032  __Pyx_Buffer __pyx_pybuffer_x;
19033  PyObject *__pyx_r = NULL;
19034  __Pyx_RefNannyDeclarations
19035  npy_intp __pyx_t_1;
19036  int __pyx_t_2;
19037  npy_intp __pyx_t_3;
19038  int __pyx_t_4;
19039  Py_ssize_t __pyx_t_5;
19040  Py_ssize_t __pyx_t_6;
19041  Py_ssize_t __pyx_t_7;
19042  int __pyx_t_8;
19043  Py_ssize_t __pyx_t_9;
19044  Py_ssize_t __pyx_t_10;
19045  Py_ssize_t __pyx_t_11;
19046  Py_ssize_t __pyx_t_12;
19047  Py_ssize_t __pyx_t_13;
19048  Py_ssize_t __pyx_t_14;
19049  Py_ssize_t __pyx_t_15;
19050  Py_ssize_t __pyx_t_16;
19051  Py_ssize_t __pyx_t_17;
19052  Py_ssize_t __pyx_t_18;
19053  Py_ssize_t __pyx_t_19;
19054  Py_ssize_t __pyx_t_20;
19055  Py_ssize_t __pyx_t_21;
19056  Py_ssize_t __pyx_t_22;
19057  Py_ssize_t __pyx_t_23;
19058  Py_ssize_t __pyx_t_24;
19059  Py_ssize_t __pyx_t_25;
19060  Py_ssize_t __pyx_t_26;
19061  Py_ssize_t __pyx_t_27;
19062  Py_ssize_t __pyx_t_28;
19063  Py_ssize_t __pyx_t_29;
19064  int __pyx_lineno = 0;
19065  const char *__pyx_filename = NULL;
19066  int __pyx_clineno = 0;
19067  __Pyx_RefNannySetupContext("vortexElementVelocityEval3", 0);
19068  __pyx_pybuffer_x.pybuffer.buf = NULL;
19069  __pyx_pybuffer_x.refcount = 0;
19070  __pyx_pybuffernd_x.data = NULL;
19071  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
19072  __pyx_pybuffer_v.pybuffer.buf = NULL;
19073  __pyx_pybuffer_v.refcount = 0;
19074  __pyx_pybuffernd_v.data = NULL;
19075  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
19076  {
19077  __Pyx_BufFmt_StackElem __pyx_stack[1];
19078  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19079  }
19080  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
19081  {
19082  __Pyx_BufFmt_StackElem __pyx_stack[1];
19083  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19084  }
19085  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2];
19086 
19087  /* "subsurfaceTransportFunctions.pyx":916
19088  * cdef int eN,k
19089  * cdef double pi,one8
19090  * pi = M_PI # <<<<<<<<<<<<<<
19091  * one8 = 1.0/8.0
19092  * for eN in range(x.shape[0]):
19093  */
19094  __pyx_v_pi = M_PI;
19095 
19096  /* "subsurfaceTransportFunctions.pyx":917
19097  * cdef double pi,one8
19098  * pi = M_PI
19099  * one8 = 1.0/8.0 # <<<<<<<<<<<<<<
19100  * for eN in range(x.shape[0]):
19101  * for k in range(x.shape[1]):
19102  */
19103  __pyx_v_one8 = (1.0 / 8.0);
19104 
19105  /* "subsurfaceTransportFunctions.pyx":918
19106  * pi = M_PI
19107  * one8 = 1.0/8.0
19108  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
19109  * for k in range(x.shape[1]):
19110  * v[eN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,k,1])*sin(pi*x[eN,k,0])*sin(pi*x[eN,k,0]);
19111  */
19112  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
19113  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
19114  __pyx_v_eN = __pyx_t_2;
19115 
19116  /* "subsurfaceTransportFunctions.pyx":919
19117  * one8 = 1.0/8.0
19118  * for eN in range(x.shape[0]):
19119  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
19120  * v[eN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,k,1])*sin(pi*x[eN,k,0])*sin(pi*x[eN,k,0]);
19121  * v[eN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,k,0])*sin(pi*x[eN,k,1])*sin(pi*x[eN,k,1]);
19122  */
19123  __pyx_t_3 = (__pyx_v_x->dimensions[1]);
19124  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19125  __pyx_v_k = __pyx_t_4;
19126 
19127  /* "subsurfaceTransportFunctions.pyx":920
19128  * for eN in range(x.shape[0]):
19129  * for k in range(x.shape[1]):
19130  * v[eN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,k,1])*sin(pi*x[eN,k,0])*sin(pi*x[eN,k,0]); # <<<<<<<<<<<<<<
19131  * v[eN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,k,0])*sin(pi*x[eN,k,1])*sin(pi*x[eN,k,1]);
19132  *
19133  */
19134  __pyx_t_5 = __pyx_v_eN;
19135  __pyx_t_6 = __pyx_v_k;
19136  __pyx_t_7 = 1;
19137  __pyx_t_8 = -1;
19138  if (__pyx_t_5 < 0) {
19139  __pyx_t_5 += __pyx_pybuffernd_x.diminfo[0].shape;
19140  if (unlikely(__pyx_t_5 < 0)) __pyx_t_8 = 0;
19141  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_8 = 0;
19142  if (__pyx_t_6 < 0) {
19143  __pyx_t_6 += __pyx_pybuffernd_x.diminfo[1].shape;
19144  if (unlikely(__pyx_t_6 < 0)) __pyx_t_8 = 1;
19145  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_8 = 1;
19146  if (__pyx_t_7 < 0) {
19147  __pyx_t_7 += __pyx_pybuffernd_x.diminfo[2].shape;
19148  if (unlikely(__pyx_t_7 < 0)) __pyx_t_8 = 2;
19149  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_8 = 2;
19150  if (unlikely(__pyx_t_8 != -1)) {
19151  __Pyx_RaiseBufferIndexError(__pyx_t_8);
19152  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19153  }
19154  __pyx_t_9 = __pyx_v_eN;
19155  __pyx_t_10 = __pyx_v_k;
19156  __pyx_t_11 = 0;
19157  __pyx_t_8 = -1;
19158  if (__pyx_t_9 < 0) {
19159  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[0].shape;
19160  if (unlikely(__pyx_t_9 < 0)) __pyx_t_8 = 0;
19161  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_8 = 0;
19162  if (__pyx_t_10 < 0) {
19163  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[1].shape;
19164  if (unlikely(__pyx_t_10 < 0)) __pyx_t_8 = 1;
19165  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_8 = 1;
19166  if (__pyx_t_11 < 0) {
19167  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[2].shape;
19168  if (unlikely(__pyx_t_11 < 0)) __pyx_t_8 = 2;
19169  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_8 = 2;
19170  if (unlikely(__pyx_t_8 != -1)) {
19171  __Pyx_RaiseBufferIndexError(__pyx_t_8);
19172  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19173  }
19174  __pyx_t_12 = __pyx_v_eN;
19175  __pyx_t_13 = __pyx_v_k;
19176  __pyx_t_14 = 0;
19177  __pyx_t_8 = -1;
19178  if (__pyx_t_12 < 0) {
19179  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[0].shape;
19180  if (unlikely(__pyx_t_12 < 0)) __pyx_t_8 = 0;
19181  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_8 = 0;
19182  if (__pyx_t_13 < 0) {
19183  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[1].shape;
19184  if (unlikely(__pyx_t_13 < 0)) __pyx_t_8 = 1;
19185  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_8 = 1;
19186  if (__pyx_t_14 < 0) {
19187  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[2].shape;
19188  if (unlikely(__pyx_t_14 < 0)) __pyx_t_8 = 2;
19189  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_8 = 2;
19190  if (unlikely(__pyx_t_8 != -1)) {
19191  __Pyx_RaiseBufferIndexError(__pyx_t_8);
19192  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19193  }
19194  __pyx_t_15 = __pyx_v_eN;
19195  __pyx_t_16 = __pyx_v_k;
19196  __pyx_t_17 = 0;
19197  __pyx_t_8 = -1;
19198  if (__pyx_t_15 < 0) {
19199  __pyx_t_15 += __pyx_pybuffernd_v.diminfo[0].shape;
19200  if (unlikely(__pyx_t_15 < 0)) __pyx_t_8 = 0;
19201  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_8 = 0;
19202  if (__pyx_t_16 < 0) {
19203  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[1].shape;
19204  if (unlikely(__pyx_t_16 < 0)) __pyx_t_8 = 1;
19205  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_8 = 1;
19206  if (__pyx_t_17 < 0) {
19207  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[2].shape;
19208  if (unlikely(__pyx_t_17 < 0)) __pyx_t_8 = 2;
19209  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_8 = 2;
19210  if (unlikely(__pyx_t_8 != -1)) {
19211  __Pyx_RaiseBufferIndexError(__pyx_t_8);
19212  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19213  }
19214  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[2].strides) = (((cos(((__pyx_v_pi * __pyx_v_one8) * __pyx_v_t)) * sin(((2.0 * __pyx_v_pi) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_7, __pyx_pybuffernd_x.diminfo[2].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[2].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_14, __pyx_pybuffernd_x.diminfo[2].strides)))));
19215 
19216  /* "subsurfaceTransportFunctions.pyx":921
19217  * for k in range(x.shape[1]):
19218  * v[eN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,k,1])*sin(pi*x[eN,k,0])*sin(pi*x[eN,k,0]);
19219  * v[eN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,k,0])*sin(pi*x[eN,k,1])*sin(pi*x[eN,k,1]); # <<<<<<<<<<<<<<
19220  *
19221  *
19222  */
19223  __pyx_t_18 = __pyx_v_eN;
19224  __pyx_t_19 = __pyx_v_k;
19225  __pyx_t_20 = 0;
19226  __pyx_t_8 = -1;
19227  if (__pyx_t_18 < 0) {
19228  __pyx_t_18 += __pyx_pybuffernd_x.diminfo[0].shape;
19229  if (unlikely(__pyx_t_18 < 0)) __pyx_t_8 = 0;
19230  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_8 = 0;
19231  if (__pyx_t_19 < 0) {
19232  __pyx_t_19 += __pyx_pybuffernd_x.diminfo[1].shape;
19233  if (unlikely(__pyx_t_19 < 0)) __pyx_t_8 = 1;
19234  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_8 = 1;
19235  if (__pyx_t_20 < 0) {
19236  __pyx_t_20 += __pyx_pybuffernd_x.diminfo[2].shape;
19237  if (unlikely(__pyx_t_20 < 0)) __pyx_t_8 = 2;
19238  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_8 = 2;
19239  if (unlikely(__pyx_t_8 != -1)) {
19240  __Pyx_RaiseBufferIndexError(__pyx_t_8);
19241  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19242  }
19243  __pyx_t_21 = __pyx_v_eN;
19244  __pyx_t_22 = __pyx_v_k;
19245  __pyx_t_23 = 1;
19246  __pyx_t_8 = -1;
19247  if (__pyx_t_21 < 0) {
19248  __pyx_t_21 += __pyx_pybuffernd_x.diminfo[0].shape;
19249  if (unlikely(__pyx_t_21 < 0)) __pyx_t_8 = 0;
19250  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_8 = 0;
19251  if (__pyx_t_22 < 0) {
19252  __pyx_t_22 += __pyx_pybuffernd_x.diminfo[1].shape;
19253  if (unlikely(__pyx_t_22 < 0)) __pyx_t_8 = 1;
19254  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_8 = 1;
19255  if (__pyx_t_23 < 0) {
19256  __pyx_t_23 += __pyx_pybuffernd_x.diminfo[2].shape;
19257  if (unlikely(__pyx_t_23 < 0)) __pyx_t_8 = 2;
19258  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_8 = 2;
19259  if (unlikely(__pyx_t_8 != -1)) {
19260  __Pyx_RaiseBufferIndexError(__pyx_t_8);
19261  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19262  }
19263  __pyx_t_24 = __pyx_v_eN;
19264  __pyx_t_25 = __pyx_v_k;
19265  __pyx_t_26 = 1;
19266  __pyx_t_8 = -1;
19267  if (__pyx_t_24 < 0) {
19268  __pyx_t_24 += __pyx_pybuffernd_x.diminfo[0].shape;
19269  if (unlikely(__pyx_t_24 < 0)) __pyx_t_8 = 0;
19270  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_8 = 0;
19271  if (__pyx_t_25 < 0) {
19272  __pyx_t_25 += __pyx_pybuffernd_x.diminfo[1].shape;
19273  if (unlikely(__pyx_t_25 < 0)) __pyx_t_8 = 1;
19274  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_8 = 1;
19275  if (__pyx_t_26 < 0) {
19276  __pyx_t_26 += __pyx_pybuffernd_x.diminfo[2].shape;
19277  if (unlikely(__pyx_t_26 < 0)) __pyx_t_8 = 2;
19278  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_8 = 2;
19279  if (unlikely(__pyx_t_8 != -1)) {
19280  __Pyx_RaiseBufferIndexError(__pyx_t_8);
19281  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19282  }
19283  __pyx_t_27 = __pyx_v_eN;
19284  __pyx_t_28 = __pyx_v_k;
19285  __pyx_t_29 = 1;
19286  __pyx_t_8 = -1;
19287  if (__pyx_t_27 < 0) {
19288  __pyx_t_27 += __pyx_pybuffernd_v.diminfo[0].shape;
19289  if (unlikely(__pyx_t_27 < 0)) __pyx_t_8 = 0;
19290  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_8 = 0;
19291  if (__pyx_t_28 < 0) {
19292  __pyx_t_28 += __pyx_pybuffernd_v.diminfo[1].shape;
19293  if (unlikely(__pyx_t_28 < 0)) __pyx_t_8 = 1;
19294  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_8 = 1;
19295  if (__pyx_t_29 < 0) {
19296  __pyx_t_29 += __pyx_pybuffernd_v.diminfo[2].shape;
19297  if (unlikely(__pyx_t_29 < 0)) __pyx_t_8 = 2;
19298  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_8 = 2;
19299  if (unlikely(__pyx_t_8 != -1)) {
19300  __Pyx_RaiseBufferIndexError(__pyx_t_8);
19301  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19302  }
19303  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_29, __pyx_pybuffernd_v.diminfo[2].strides) = ((((-cos(((__pyx_v_pi * __pyx_v_one8) * __pyx_v_t))) * sin(((2.0 * __pyx_v_pi) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_20, __pyx_pybuffernd_x.diminfo[2].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_23, __pyx_pybuffernd_x.diminfo[2].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_26, __pyx_pybuffernd_x.diminfo[2].strides)))));
19304  }
19305  }
19306 
19307  /* "subsurfaceTransportFunctions.pyx":911
19308  * v[eN,ebN,k,2]=zVelocity
19309  *
19310  * def vortexElementVelocityEval3(double t, # <<<<<<<<<<<<<<
19311  * numpy.ndarray[DTYPE_t,ndim=3] x,
19312  * numpy.ndarray[DTYPE_t,ndim=3] v):
19313  */
19314 
19315  /* function exit code */
19316  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
19317  goto __pyx_L0;
19318  __pyx_L1_error:;
19319  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
19320  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
19321  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
19322  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
19323  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
19324  __Pyx_AddTraceback("subsurfaceTransportFunctions.vortexElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
19325  __pyx_r = NULL;
19326  goto __pyx_L2;
19327  __pyx_L0:;
19328  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
19329  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
19330  __pyx_L2:;
19331  __Pyx_XGIVEREF(__pyx_r);
19332  __Pyx_RefNannyFinishContext();
19333  return __pyx_r;
19334 }
19335 
19336 /* "subsurfaceTransportFunctions.pyx":924
19337  *
19338  *
19339  * def vortexElementVelocityEval4(double t, # <<<<<<<<<<<<<<
19340  * numpy.ndarray[DTYPE_t,ndim=4] x,
19341  * numpy.ndarray[DTYPE_t,ndim=4] v):
19342  */
19343 
19344 /* Python wrapper */
19345 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_57vortexElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
19346 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_57vortexElementVelocityEval4 = {"vortexElementVelocityEval4", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_57vortexElementVelocityEval4, METH_VARARGS|METH_KEYWORDS, 0};
19347 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_57vortexElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
19348  double __pyx_v_t;
19349  PyArrayObject *__pyx_v_x = 0;
19350  PyArrayObject *__pyx_v_v = 0;
19351  int __pyx_lineno = 0;
19352  const char *__pyx_filename = NULL;
19353  int __pyx_clineno = 0;
19354  PyObject *__pyx_r = 0;
19355  __Pyx_RefNannyDeclarations
19356  __Pyx_RefNannySetupContext("vortexElementVelocityEval4 (wrapper)", 0);
19357  {
19358  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_x,&__pyx_n_s_v,0};
19359  PyObject* values[3] = {0,0,0};
19360  if (unlikely(__pyx_kwds)) {
19361  Py_ssize_t kw_args;
19362  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
19363  switch (pos_args) {
19364  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19365  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19366  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19367  case 0: break;
19368  default: goto __pyx_L5_argtuple_error;
19369  }
19370  kw_args = PyDict_Size(__pyx_kwds);
19371  switch (pos_args) {
19372  case 0:
19373  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
19374  else goto __pyx_L5_argtuple_error;
19375  case 1:
19376  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
19377  else {
19378  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval4", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
19379  }
19380  case 2:
19381  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
19382  else {
19383  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval4", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
19384  }
19385  }
19386  if (unlikely(kw_args > 0)) {
19387  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vortexElementVelocityEval4") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
19388  }
19389  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
19390  goto __pyx_L5_argtuple_error;
19391  } else {
19392  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19393  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19394  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19395  }
19396  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
19397  __pyx_v_x = ((PyArrayObject *)values[1]);
19398  __pyx_v_v = ((PyArrayObject *)values[2]);
19399  }
19400  goto __pyx_L4_argument_unpacking_done;
19401  __pyx_L5_argtuple_error:;
19402  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval4", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
19403  __pyx_L3_error:;
19404  __Pyx_AddTraceback("subsurfaceTransportFunctions.vortexElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
19405  __Pyx_RefNannyFinishContext();
19406  return NULL;
19407  __pyx_L4_argument_unpacking_done:;
19408  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19409  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19410  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_56vortexElementVelocityEval4(__pyx_self, __pyx_v_t, __pyx_v_x, __pyx_v_v);
19411 
19412  /* function exit code */
19413  goto __pyx_L0;
19414  __pyx_L1_error:;
19415  __pyx_r = NULL;
19416  __pyx_L0:;
19417  __Pyx_RefNannyFinishContext();
19418  return __pyx_r;
19419 }
19420 
19421 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_56vortexElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v) {
19422  int __pyx_v_eN;
19423  int __pyx_v_k;
19424  int __pyx_v_ebN;
19425  double __pyx_v_pi;
19426  double __pyx_v_one8;
19427  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
19428  __Pyx_Buffer __pyx_pybuffer_v;
19429  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
19430  __Pyx_Buffer __pyx_pybuffer_x;
19431  PyObject *__pyx_r = NULL;
19432  __Pyx_RefNannyDeclarations
19433  npy_intp __pyx_t_1;
19434  int __pyx_t_2;
19435  npy_intp __pyx_t_3;
19436  int __pyx_t_4;
19437  npy_intp __pyx_t_5;
19438  int __pyx_t_6;
19439  Py_ssize_t __pyx_t_7;
19440  Py_ssize_t __pyx_t_8;
19441  Py_ssize_t __pyx_t_9;
19442  Py_ssize_t __pyx_t_10;
19443  int __pyx_t_11;
19444  Py_ssize_t __pyx_t_12;
19445  Py_ssize_t __pyx_t_13;
19446  Py_ssize_t __pyx_t_14;
19447  Py_ssize_t __pyx_t_15;
19448  Py_ssize_t __pyx_t_16;
19449  Py_ssize_t __pyx_t_17;
19450  Py_ssize_t __pyx_t_18;
19451  Py_ssize_t __pyx_t_19;
19452  Py_ssize_t __pyx_t_20;
19453  Py_ssize_t __pyx_t_21;
19454  Py_ssize_t __pyx_t_22;
19455  Py_ssize_t __pyx_t_23;
19456  Py_ssize_t __pyx_t_24;
19457  Py_ssize_t __pyx_t_25;
19458  Py_ssize_t __pyx_t_26;
19459  Py_ssize_t __pyx_t_27;
19460  Py_ssize_t __pyx_t_28;
19461  Py_ssize_t __pyx_t_29;
19462  Py_ssize_t __pyx_t_30;
19463  Py_ssize_t __pyx_t_31;
19464  Py_ssize_t __pyx_t_32;
19465  Py_ssize_t __pyx_t_33;
19466  Py_ssize_t __pyx_t_34;
19467  Py_ssize_t __pyx_t_35;
19468  Py_ssize_t __pyx_t_36;
19469  Py_ssize_t __pyx_t_37;
19470  Py_ssize_t __pyx_t_38;
19471  Py_ssize_t __pyx_t_39;
19472  int __pyx_lineno = 0;
19473  const char *__pyx_filename = NULL;
19474  int __pyx_clineno = 0;
19475  __Pyx_RefNannySetupContext("vortexElementVelocityEval4", 0);
19476  __pyx_pybuffer_x.pybuffer.buf = NULL;
19477  __pyx_pybuffer_x.refcount = 0;
19478  __pyx_pybuffernd_x.data = NULL;
19479  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
19480  __pyx_pybuffer_v.pybuffer.buf = NULL;
19481  __pyx_pybuffer_v.refcount = 0;
19482  __pyx_pybuffernd_v.data = NULL;
19483  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
19484  {
19485  __Pyx_BufFmt_StackElem __pyx_stack[1];
19486  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19487  }
19488  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
19489  {
19490  __Pyx_BufFmt_StackElem __pyx_stack[1];
19491  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19492  }
19493  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_v.diminfo[3].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_v.diminfo[3].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[3];
19494 
19495  /* "subsurfaceTransportFunctions.pyx":929
19496  * cdef int eN,k,ebN
19497  * cdef double pi,one8
19498  * pi = M_PI # <<<<<<<<<<<<<<
19499  * one8 = 1.0/8.0
19500  * for eN in range(x.shape[0]):
19501  */
19502  __pyx_v_pi = M_PI;
19503 
19504  /* "subsurfaceTransportFunctions.pyx":930
19505  * cdef double pi,one8
19506  * pi = M_PI
19507  * one8 = 1.0/8.0 # <<<<<<<<<<<<<<
19508  * for eN in range(x.shape[0]):
19509  * for ebN in range(x.shape[1]):
19510  */
19511  __pyx_v_one8 = (1.0 / 8.0);
19512 
19513  /* "subsurfaceTransportFunctions.pyx":931
19514  * pi = M_PI
19515  * one8 = 1.0/8.0
19516  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
19517  * for ebN in range(x.shape[1]):
19518  * for k in range(x.shape[2]):
19519  */
19520  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
19521  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
19522  __pyx_v_eN = __pyx_t_2;
19523 
19524  /* "subsurfaceTransportFunctions.pyx":932
19525  * one8 = 1.0/8.0
19526  * for eN in range(x.shape[0]):
19527  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
19528  * for k in range(x.shape[2]):
19529  * v[eN,ebN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,0]);
19530  */
19531  __pyx_t_3 = (__pyx_v_x->dimensions[1]);
19532  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19533  __pyx_v_ebN = __pyx_t_4;
19534 
19535  /* "subsurfaceTransportFunctions.pyx":933
19536  * for eN in range(x.shape[0]):
19537  * for ebN in range(x.shape[1]):
19538  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
19539  * v[eN,ebN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,0]);
19540  * v[eN,ebN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,1]);
19541  */
19542  __pyx_t_5 = (__pyx_v_x->dimensions[2]);
19543  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
19544  __pyx_v_k = __pyx_t_6;
19545 
19546  /* "subsurfaceTransportFunctions.pyx":934
19547  * for ebN in range(x.shape[1]):
19548  * for k in range(x.shape[2]):
19549  * v[eN,ebN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,0]); # <<<<<<<<<<<<<<
19550  * v[eN,ebN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,1]);
19551  *
19552  */
19553  __pyx_t_7 = __pyx_v_eN;
19554  __pyx_t_8 = __pyx_v_ebN;
19555  __pyx_t_9 = __pyx_v_k;
19556  __pyx_t_10 = 1;
19557  __pyx_t_11 = -1;
19558  if (__pyx_t_7 < 0) {
19559  __pyx_t_7 += __pyx_pybuffernd_x.diminfo[0].shape;
19560  if (unlikely(__pyx_t_7 < 0)) __pyx_t_11 = 0;
19561  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
19562  if (__pyx_t_8 < 0) {
19563  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[1].shape;
19564  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 1;
19565  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
19566  if (__pyx_t_9 < 0) {
19567  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[2].shape;
19568  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 2;
19569  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
19570  if (__pyx_t_10 < 0) {
19571  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[3].shape;
19572  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 3;
19573  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_11 = 3;
19574  if (unlikely(__pyx_t_11 != -1)) {
19575  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19576  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19577  }
19578  __pyx_t_12 = __pyx_v_eN;
19579  __pyx_t_13 = __pyx_v_ebN;
19580  __pyx_t_14 = __pyx_v_k;
19581  __pyx_t_15 = 0;
19582  __pyx_t_11 = -1;
19583  if (__pyx_t_12 < 0) {
19584  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[0].shape;
19585  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 0;
19586  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
19587  if (__pyx_t_13 < 0) {
19588  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[1].shape;
19589  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
19590  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
19591  if (__pyx_t_14 < 0) {
19592  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[2].shape;
19593  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 2;
19594  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
19595  if (__pyx_t_15 < 0) {
19596  __pyx_t_15 += __pyx_pybuffernd_x.diminfo[3].shape;
19597  if (unlikely(__pyx_t_15 < 0)) __pyx_t_11 = 3;
19598  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_11 = 3;
19599  if (unlikely(__pyx_t_11 != -1)) {
19600  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19601  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19602  }
19603  __pyx_t_16 = __pyx_v_eN;
19604  __pyx_t_17 = __pyx_v_ebN;
19605  __pyx_t_18 = __pyx_v_k;
19606  __pyx_t_19 = 0;
19607  __pyx_t_11 = -1;
19608  if (__pyx_t_16 < 0) {
19609  __pyx_t_16 += __pyx_pybuffernd_x.diminfo[0].shape;
19610  if (unlikely(__pyx_t_16 < 0)) __pyx_t_11 = 0;
19611  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
19612  if (__pyx_t_17 < 0) {
19613  __pyx_t_17 += __pyx_pybuffernd_x.diminfo[1].shape;
19614  if (unlikely(__pyx_t_17 < 0)) __pyx_t_11 = 1;
19615  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
19616  if (__pyx_t_18 < 0) {
19617  __pyx_t_18 += __pyx_pybuffernd_x.diminfo[2].shape;
19618  if (unlikely(__pyx_t_18 < 0)) __pyx_t_11 = 2;
19619  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
19620  if (__pyx_t_19 < 0) {
19621  __pyx_t_19 += __pyx_pybuffernd_x.diminfo[3].shape;
19622  if (unlikely(__pyx_t_19 < 0)) __pyx_t_11 = 3;
19623  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_11 = 3;
19624  if (unlikely(__pyx_t_11 != -1)) {
19625  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19626  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19627  }
19628  __pyx_t_20 = __pyx_v_eN;
19629  __pyx_t_21 = __pyx_v_ebN;
19630  __pyx_t_22 = __pyx_v_k;
19631  __pyx_t_23 = 0;
19632  __pyx_t_11 = -1;
19633  if (__pyx_t_20 < 0) {
19634  __pyx_t_20 += __pyx_pybuffernd_v.diminfo[0].shape;
19635  if (unlikely(__pyx_t_20 < 0)) __pyx_t_11 = 0;
19636  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
19637  if (__pyx_t_21 < 0) {
19638  __pyx_t_21 += __pyx_pybuffernd_v.diminfo[1].shape;
19639  if (unlikely(__pyx_t_21 < 0)) __pyx_t_11 = 1;
19640  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
19641  if (__pyx_t_22 < 0) {
19642  __pyx_t_22 += __pyx_pybuffernd_v.diminfo[2].shape;
19643  if (unlikely(__pyx_t_22 < 0)) __pyx_t_11 = 2;
19644  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
19645  if (__pyx_t_23 < 0) {
19646  __pyx_t_23 += __pyx_pybuffernd_v.diminfo[3].shape;
19647  if (unlikely(__pyx_t_23 < 0)) __pyx_t_11 = 3;
19648  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_11 = 3;
19649  if (unlikely(__pyx_t_11 != -1)) {
19650  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19651  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19652  }
19653  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_22, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_23, __pyx_pybuffernd_v.diminfo[3].strides) = (((cos(((__pyx_v_pi * __pyx_v_one8) * __pyx_v_t)) * sin(((2.0 * __pyx_v_pi) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_10, __pyx_pybuffernd_x.diminfo[3].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_14, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_15, __pyx_pybuffernd_x.diminfo[3].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_19, __pyx_pybuffernd_x.diminfo[3].strides)))));
19654 
19655  /* "subsurfaceTransportFunctions.pyx":935
19656  * for k in range(x.shape[2]):
19657  * v[eN,ebN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,0]);
19658  * v[eN,ebN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,1]); # <<<<<<<<<<<<<<
19659  *
19660  *
19661  */
19662  __pyx_t_24 = __pyx_v_eN;
19663  __pyx_t_25 = __pyx_v_ebN;
19664  __pyx_t_26 = __pyx_v_k;
19665  __pyx_t_27 = 0;
19666  __pyx_t_11 = -1;
19667  if (__pyx_t_24 < 0) {
19668  __pyx_t_24 += __pyx_pybuffernd_x.diminfo[0].shape;
19669  if (unlikely(__pyx_t_24 < 0)) __pyx_t_11 = 0;
19670  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
19671  if (__pyx_t_25 < 0) {
19672  __pyx_t_25 += __pyx_pybuffernd_x.diminfo[1].shape;
19673  if (unlikely(__pyx_t_25 < 0)) __pyx_t_11 = 1;
19674  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
19675  if (__pyx_t_26 < 0) {
19676  __pyx_t_26 += __pyx_pybuffernd_x.diminfo[2].shape;
19677  if (unlikely(__pyx_t_26 < 0)) __pyx_t_11 = 2;
19678  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
19679  if (__pyx_t_27 < 0) {
19680  __pyx_t_27 += __pyx_pybuffernd_x.diminfo[3].shape;
19681  if (unlikely(__pyx_t_27 < 0)) __pyx_t_11 = 3;
19682  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_11 = 3;
19683  if (unlikely(__pyx_t_11 != -1)) {
19684  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19685  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19686  }
19687  __pyx_t_28 = __pyx_v_eN;
19688  __pyx_t_29 = __pyx_v_ebN;
19689  __pyx_t_30 = __pyx_v_k;
19690  __pyx_t_31 = 1;
19691  __pyx_t_11 = -1;
19692  if (__pyx_t_28 < 0) {
19693  __pyx_t_28 += __pyx_pybuffernd_x.diminfo[0].shape;
19694  if (unlikely(__pyx_t_28 < 0)) __pyx_t_11 = 0;
19695  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
19696  if (__pyx_t_29 < 0) {
19697  __pyx_t_29 += __pyx_pybuffernd_x.diminfo[1].shape;
19698  if (unlikely(__pyx_t_29 < 0)) __pyx_t_11 = 1;
19699  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
19700  if (__pyx_t_30 < 0) {
19701  __pyx_t_30 += __pyx_pybuffernd_x.diminfo[2].shape;
19702  if (unlikely(__pyx_t_30 < 0)) __pyx_t_11 = 2;
19703  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
19704  if (__pyx_t_31 < 0) {
19705  __pyx_t_31 += __pyx_pybuffernd_x.diminfo[3].shape;
19706  if (unlikely(__pyx_t_31 < 0)) __pyx_t_11 = 3;
19707  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_11 = 3;
19708  if (unlikely(__pyx_t_11 != -1)) {
19709  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19710  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19711  }
19712  __pyx_t_32 = __pyx_v_eN;
19713  __pyx_t_33 = __pyx_v_ebN;
19714  __pyx_t_34 = __pyx_v_k;
19715  __pyx_t_35 = 1;
19716  __pyx_t_11 = -1;
19717  if (__pyx_t_32 < 0) {
19718  __pyx_t_32 += __pyx_pybuffernd_x.diminfo[0].shape;
19719  if (unlikely(__pyx_t_32 < 0)) __pyx_t_11 = 0;
19720  } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
19721  if (__pyx_t_33 < 0) {
19722  __pyx_t_33 += __pyx_pybuffernd_x.diminfo[1].shape;
19723  if (unlikely(__pyx_t_33 < 0)) __pyx_t_11 = 1;
19724  } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
19725  if (__pyx_t_34 < 0) {
19726  __pyx_t_34 += __pyx_pybuffernd_x.diminfo[2].shape;
19727  if (unlikely(__pyx_t_34 < 0)) __pyx_t_11 = 2;
19728  } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
19729  if (__pyx_t_35 < 0) {
19730  __pyx_t_35 += __pyx_pybuffernd_x.diminfo[3].shape;
19731  if (unlikely(__pyx_t_35 < 0)) __pyx_t_11 = 3;
19732  } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_11 = 3;
19733  if (unlikely(__pyx_t_11 != -1)) {
19734  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19735  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19736  }
19737  __pyx_t_36 = __pyx_v_eN;
19738  __pyx_t_37 = __pyx_v_ebN;
19739  __pyx_t_38 = __pyx_v_k;
19740  __pyx_t_39 = 1;
19741  __pyx_t_11 = -1;
19742  if (__pyx_t_36 < 0) {
19743  __pyx_t_36 += __pyx_pybuffernd_v.diminfo[0].shape;
19744  if (unlikely(__pyx_t_36 < 0)) __pyx_t_11 = 0;
19745  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
19746  if (__pyx_t_37 < 0) {
19747  __pyx_t_37 += __pyx_pybuffernd_v.diminfo[1].shape;
19748  if (unlikely(__pyx_t_37 < 0)) __pyx_t_11 = 1;
19749  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
19750  if (__pyx_t_38 < 0) {
19751  __pyx_t_38 += __pyx_pybuffernd_v.diminfo[2].shape;
19752  if (unlikely(__pyx_t_38 < 0)) __pyx_t_11 = 2;
19753  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
19754  if (__pyx_t_39 < 0) {
19755  __pyx_t_39 += __pyx_pybuffernd_v.diminfo[3].shape;
19756  if (unlikely(__pyx_t_39 < 0)) __pyx_t_11 = 3;
19757  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_11 = 3;
19758  if (unlikely(__pyx_t_11 != -1)) {
19759  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19760  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19761  }
19762  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_38, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_39, __pyx_pybuffernd_v.diminfo[3].strides) = ((((-cos(((__pyx_v_pi * __pyx_v_one8) * __pyx_v_t))) * sin(((2.0 * __pyx_v_pi) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_26, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_27, __pyx_pybuffernd_x.diminfo[3].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_30, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_31, __pyx_pybuffernd_x.diminfo[3].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_34, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_35, __pyx_pybuffernd_x.diminfo[3].strides)))));
19763  }
19764  }
19765  }
19766 
19767  /* "subsurfaceTransportFunctions.pyx":924
19768  *
19769  *
19770  * def vortexElementVelocityEval4(double t, # <<<<<<<<<<<<<<
19771  * numpy.ndarray[DTYPE_t,ndim=4] x,
19772  * numpy.ndarray[DTYPE_t,ndim=4] v):
19773  */
19774 
19775  /* function exit code */
19776  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
19777  goto __pyx_L0;
19778  __pyx_L1_error:;
19779  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
19780  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
19781  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
19782  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
19783  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
19784  __Pyx_AddTraceback("subsurfaceTransportFunctions.vortexElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
19785  __pyx_r = NULL;
19786  goto __pyx_L2;
19787  __pyx_L0:;
19788  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
19789  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
19790  __pyx_L2:;
19791  __Pyx_XGIVEREF(__pyx_r);
19792  __Pyx_RefNannyFinishContext();
19793  return __pyx_r;
19794 }
19795 
19796 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":197
19797  * # experimental exception made for __getbuffer__ and __releasebuffer__
19798  * # -- the details of this may change.
19799  * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
19800  * # This implementation of getbuffer is geared towards Cython
19801  * # requirements, and does not yet fullfill the PEP.
19802  */
19803 
19804 /* Python wrapper */
19805 static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
19806 static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
19807  int __pyx_r;
19808  __Pyx_RefNannyDeclarations
19809  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
19810  __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
19811 
19812  /* function exit code */
19813  __Pyx_RefNannyFinishContext();
19814  return __pyx_r;
19815 }
19816 
19817 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
19818  int __pyx_v_copy_shape;
19819  int __pyx_v_i;
19820  int __pyx_v_ndim;
19821  int __pyx_v_endian_detector;
19822  int __pyx_v_little_endian;
19823  int __pyx_v_t;
19824  char *__pyx_v_f;
19825  PyArray_Descr *__pyx_v_descr = 0;
19826  int __pyx_v_offset;
19827  int __pyx_v_hasfields;
19828  int __pyx_r;
19829  __Pyx_RefNannyDeclarations
19830  int __pyx_t_1;
19831  int __pyx_t_2;
19832  PyObject *__pyx_t_3 = NULL;
19833  int __pyx_t_4;
19834  int __pyx_t_5;
19835  PyObject *__pyx_t_6 = NULL;
19836  char *__pyx_t_7;
19837  int __pyx_lineno = 0;
19838  const char *__pyx_filename = NULL;
19839  int __pyx_clineno = 0;
19840  __Pyx_RefNannySetupContext("__getbuffer__", 0);
19841  if (__pyx_v_info != NULL) {
19842  __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
19843  __Pyx_GIVEREF(__pyx_v_info->obj);
19844  }
19845 
19846  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":203
19847  * # of flags
19848  *
19849  * if info == NULL: return # <<<<<<<<<<<<<<
19850  *
19851  * cdef int copy_shape, i, ndim
19852  */
19853  __pyx_t_1 = ((__pyx_v_info == NULL) != 0);
19854  if (__pyx_t_1) {
19855  __pyx_r = 0;
19856  goto __pyx_L0;
19857  }
19858 
19859  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":206
19860  *
19861  * cdef int copy_shape, i, ndim
19862  * cdef int endian_detector = 1 # <<<<<<<<<<<<<<
19863  * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
19864  *
19865  */
19866  __pyx_v_endian_detector = 1;
19867 
19868  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":207
19869  * cdef int copy_shape, i, ndim
19870  * cdef int endian_detector = 1
19871  * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
19872  *
19873  * ndim = PyArray_NDIM(self)
19874  */
19875  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
19876 
19877  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":209
19878  * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
19879  *
19880  * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<<
19881  *
19882  * if sizeof(npy_intp) != sizeof(Py_ssize_t):
19883  */
19884  __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);
19885 
19886  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":211
19887  * ndim = PyArray_NDIM(self)
19888  *
19889  * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
19890  * copy_shape = 1
19891  * else:
19892  */
19893  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
19894  if (__pyx_t_1) {
19895 
19896  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":212
19897  *
19898  * if sizeof(npy_intp) != sizeof(Py_ssize_t):
19899  * copy_shape = 1 # <<<<<<<<<<<<<<
19900  * else:
19901  * copy_shape = 0
19902  */
19903  __pyx_v_copy_shape = 1;
19904 
19905  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":211
19906  * ndim = PyArray_NDIM(self)
19907  *
19908  * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
19909  * copy_shape = 1
19910  * else:
19911  */
19912  goto __pyx_L4;
19913  }
19914 
19915  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":214
19916  * copy_shape = 1
19917  * else:
19918  * copy_shape = 0 # <<<<<<<<<<<<<<
19919  *
19920  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
19921  */
19922  /*else*/ {
19923  __pyx_v_copy_shape = 0;
19924  }
19925  __pyx_L4:;
19926 
19927  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":216
19928  * copy_shape = 0
19929  *
19930  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
19931  * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
19932  * raise ValueError(u"ndarray is not C contiguous")
19933  */
19934  __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
19935  if (__pyx_t_2) {
19936  } else {
19937  __pyx_t_1 = __pyx_t_2;
19938  goto __pyx_L6_bool_binop_done;
19939  }
19940 
19941  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":217
19942  *
19943  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
19944  * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<<
19945  * raise ValueError(u"ndarray is not C contiguous")
19946  *
19947  */
19948  __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0);
19949  __pyx_t_1 = __pyx_t_2;
19950  __pyx_L6_bool_binop_done:;
19951 
19952  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":216
19953  * copy_shape = 0
19954  *
19955  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
19956  * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
19957  * raise ValueError(u"ndarray is not C contiguous")
19958  */
19959  if (__pyx_t_1) {
19960 
19961  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":218
19962  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
19963  * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
19964  * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
19965  *
19966  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
19967  */
19968  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19969  __Pyx_GOTREF(__pyx_t_3);
19970  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
19971  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19972  {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19973 
19974  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":216
19975  * copy_shape = 0
19976  *
19977  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
19978  * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
19979  * raise ValueError(u"ndarray is not C contiguous")
19980  */
19981  }
19982 
19983  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":220
19984  * raise ValueError(u"ndarray is not C contiguous")
19985  *
19986  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
19987  * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
19988  * raise ValueError(u"ndarray is not Fortran contiguous")
19989  */
19990  __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
19991  if (__pyx_t_2) {
19992  } else {
19993  __pyx_t_1 = __pyx_t_2;
19994  goto __pyx_L9_bool_binop_done;
19995  }
19996 
19997  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":221
19998  *
19999  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
20000  * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<<
20001  * raise ValueError(u"ndarray is not Fortran contiguous")
20002  *
20003  */
20004  __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0);
20005  __pyx_t_1 = __pyx_t_2;
20006  __pyx_L9_bool_binop_done:;
20007 
20008  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":220
20009  * raise ValueError(u"ndarray is not C contiguous")
20010  *
20011  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
20012  * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
20013  * raise ValueError(u"ndarray is not Fortran contiguous")
20014  */
20015  if (__pyx_t_1) {
20016 
20017  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":222
20018  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
20019  * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
20020  * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
20021  *
20022  * info.buf = PyArray_DATA(self)
20023  */
20024  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20025  __Pyx_GOTREF(__pyx_t_3);
20026  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
20027  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20028  {__pyx_filename = __pyx_f[1]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20029 
20030  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":220
20031  * raise ValueError(u"ndarray is not C contiguous")
20032  *
20033  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
20034  * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
20035  * raise ValueError(u"ndarray is not Fortran contiguous")
20036  */
20037  }
20038 
20039  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":224
20040  * raise ValueError(u"ndarray is not Fortran contiguous")
20041  *
20042  * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<<
20043  * info.ndim = ndim
20044  * if copy_shape:
20045  */
20046  __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);
20047 
20048  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":225
20049  *
20050  * info.buf = PyArray_DATA(self)
20051  * info.ndim = ndim # <<<<<<<<<<<<<<
20052  * if copy_shape:
20053  * # Allocate new buffer for strides and shape info.
20054  */
20055  __pyx_v_info->ndim = __pyx_v_ndim;
20056 
20057  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":226
20058  * info.buf = PyArray_DATA(self)
20059  * info.ndim = ndim
20060  * if copy_shape: # <<<<<<<<<<<<<<
20061  * # Allocate new buffer for strides and shape info.
20062  * # This is allocated as one block, strides first.
20063  */
20064  __pyx_t_1 = (__pyx_v_copy_shape != 0);
20065  if (__pyx_t_1) {
20066 
20067  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":229
20068  * # Allocate new buffer for strides and shape info.
20069  * # This is allocated as one block, strides first.
20070  * info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2) # <<<<<<<<<<<<<<
20071  * info.shape = info.strides + ndim
20072  * for i in range(ndim):
20073  */
20074  __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2)));
20075 
20076  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":230
20077  * # This is allocated as one block, strides first.
20078  * info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)
20079  * info.shape = info.strides + ndim # <<<<<<<<<<<<<<
20080  * for i in range(ndim):
20081  * info.strides[i] = PyArray_STRIDES(self)[i]
20082  */
20083  __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);
20084 
20085  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":231
20086  * info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)
20087  * info.shape = info.strides + ndim
20088  * for i in range(ndim): # <<<<<<<<<<<<<<
20089  * info.strides[i] = PyArray_STRIDES(self)[i]
20090  * info.shape[i] = PyArray_DIMS(self)[i]
20091  */
20092  __pyx_t_4 = __pyx_v_ndim;
20093  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
20094  __pyx_v_i = __pyx_t_5;
20095 
20096  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":232
20097  * info.shape = info.strides + ndim
20098  * for i in range(ndim):
20099  * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<<
20100  * info.shape[i] = PyArray_DIMS(self)[i]
20101  * else:
20102  */
20103  (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);
20104 
20105  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":233
20106  * for i in range(ndim):
20107  * info.strides[i] = PyArray_STRIDES(self)[i]
20108  * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<<
20109  * else:
20110  * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
20111  */
20112  (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
20113  }
20114 
20115  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":226
20116  * info.buf = PyArray_DATA(self)
20117  * info.ndim = ndim
20118  * if copy_shape: # <<<<<<<<<<<<<<
20119  * # Allocate new buffer for strides and shape info.
20120  * # This is allocated as one block, strides first.
20121  */
20122  goto __pyx_L11;
20123  }
20124 
20125  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":235
20126  * info.shape[i] = PyArray_DIMS(self)[i]
20127  * else:
20128  * info.strides = <Py_ssize_t*>PyArray_STRIDES(self) # <<<<<<<<<<<<<<
20129  * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
20130  * info.suboffsets = NULL
20131  */
20132  /*else*/ {
20133  __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));
20134 
20135  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":236
20136  * else:
20137  * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
20138  * info.shape = <Py_ssize_t*>PyArray_DIMS(self) # <<<<<<<<<<<<<<
20139  * info.suboffsets = NULL
20140  * info.itemsize = PyArray_ITEMSIZE(self)
20141  */
20142  __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
20143  }
20144  __pyx_L11:;
20145 
20146  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":237
20147  * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
20148  * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
20149  * info.suboffsets = NULL # <<<<<<<<<<<<<<
20150  * info.itemsize = PyArray_ITEMSIZE(self)
20151  * info.readonly = not PyArray_ISWRITEABLE(self)
20152  */
20153  __pyx_v_info->suboffsets = NULL;
20154 
20155  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":238
20156  * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
20157  * info.suboffsets = NULL
20158  * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<<
20159  * info.readonly = not PyArray_ISWRITEABLE(self)
20160  *
20161  */
20162  __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);
20163 
20164  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":239
20165  * info.suboffsets = NULL
20166  * info.itemsize = PyArray_ITEMSIZE(self)
20167  * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<<
20168  *
20169  * cdef int t
20170  */
20171  __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
20172 
20173  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":242
20174  *
20175  * cdef int t
20176  * cdef char* f = NULL # <<<<<<<<<<<<<<
20177  * cdef dtype descr = self.descr
20178  * cdef int offset
20179  */
20180  __pyx_v_f = NULL;
20181 
20182  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":243
20183  * cdef int t
20184  * cdef char* f = NULL
20185  * cdef dtype descr = self.descr # <<<<<<<<<<<<<<
20186  * cdef int offset
20187  *
20188  */
20189  __pyx_t_3 = ((PyObject *)__pyx_v_self->descr);
20190  __Pyx_INCREF(__pyx_t_3);
20191  __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
20192  __pyx_t_3 = 0;
20193 
20194  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":246
20195  * cdef int offset
20196  *
20197  * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<<
20198  *
20199  * if not hasfields and not copy_shape:
20200  */
20201  __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr);
20202 
20203  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":248
20204  * cdef bint hasfields = PyDataType_HASFIELDS(descr)
20205  *
20206  * if not hasfields and not copy_shape: # <<<<<<<<<<<<<<
20207  * # do not call releasebuffer
20208  * info.obj = None
20209  */
20210  __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0);
20211  if (__pyx_t_2) {
20212  } else {
20213  __pyx_t_1 = __pyx_t_2;
20214  goto __pyx_L15_bool_binop_done;
20215  }
20216  __pyx_t_2 = ((!(__pyx_v_copy_shape != 0)) != 0);
20217  __pyx_t_1 = __pyx_t_2;
20218  __pyx_L15_bool_binop_done:;
20219  if (__pyx_t_1) {
20220 
20221  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":250
20222  * if not hasfields and not copy_shape:
20223  * # do not call releasebuffer
20224  * info.obj = None # <<<<<<<<<<<<<<
20225  * else:
20226  * # need to call releasebuffer
20227  */
20228  __Pyx_INCREF(Py_None);
20229  __Pyx_GIVEREF(Py_None);
20230  __Pyx_GOTREF(__pyx_v_info->obj);
20231  __Pyx_DECREF(__pyx_v_info->obj);
20232  __pyx_v_info->obj = Py_None;
20233 
20234  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":248
20235  * cdef bint hasfields = PyDataType_HASFIELDS(descr)
20236  *
20237  * if not hasfields and not copy_shape: # <<<<<<<<<<<<<<
20238  * # do not call releasebuffer
20239  * info.obj = None
20240  */
20241  goto __pyx_L14;
20242  }
20243 
20244  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":253
20245  * else:
20246  * # need to call releasebuffer
20247  * info.obj = self # <<<<<<<<<<<<<<
20248  *
20249  * if not hasfields:
20250  */
20251  /*else*/ {
20252  __Pyx_INCREF(((PyObject *)__pyx_v_self));
20253  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
20254  __Pyx_GOTREF(__pyx_v_info->obj);
20255  __Pyx_DECREF(__pyx_v_info->obj);
20256  __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
20257  }
20258  __pyx_L14:;
20259 
20260  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":255
20261  * info.obj = self
20262  *
20263  * if not hasfields: # <<<<<<<<<<<<<<
20264  * t = descr.type_num
20265  * if ((descr.byteorder == c'>' and little_endian) or
20266  */
20267  __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0);
20268  if (__pyx_t_1) {
20269 
20270  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":256
20271  *
20272  * if not hasfields:
20273  * t = descr.type_num # <<<<<<<<<<<<<<
20274  * if ((descr.byteorder == c'>' and little_endian) or
20275  * (descr.byteorder == c'<' and not little_endian)):
20276  */
20277  __pyx_t_4 = __pyx_v_descr->type_num;
20278  __pyx_v_t = __pyx_t_4;
20279 
20280  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":257
20281  * if not hasfields:
20282  * t = descr.type_num
20283  * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
20284  * (descr.byteorder == c'<' and not little_endian)):
20285  * raise ValueError(u"Non-native byte order not supported")
20286  */
20287  __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0);
20288  if (!__pyx_t_2) {
20289  goto __pyx_L20_next_or;
20290  } else {
20291  }
20292  __pyx_t_2 = (__pyx_v_little_endian != 0);
20293  if (!__pyx_t_2) {
20294  } else {
20295  __pyx_t_1 = __pyx_t_2;
20296  goto __pyx_L19_bool_binop_done;
20297  }
20298  __pyx_L20_next_or:;
20299 
20300  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":258
20301  * t = descr.type_num
20302  * if ((descr.byteorder == c'>' and little_endian) or
20303  * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
20304  * raise ValueError(u"Non-native byte order not supported")
20305  * if t == NPY_BYTE: f = "b"
20306  */
20307  __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0);
20308  if (__pyx_t_2) {
20309  } else {
20310  __pyx_t_1 = __pyx_t_2;
20311  goto __pyx_L19_bool_binop_done;
20312  }
20313  __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
20314  __pyx_t_1 = __pyx_t_2;
20315  __pyx_L19_bool_binop_done:;
20316 
20317  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":257
20318  * if not hasfields:
20319  * t = descr.type_num
20320  * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
20321  * (descr.byteorder == c'<' and not little_endian)):
20322  * raise ValueError(u"Non-native byte order not supported")
20323  */
20324  if (__pyx_t_1) {
20325 
20326  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":259
20327  * if ((descr.byteorder == c'>' and little_endian) or
20328  * (descr.byteorder == c'<' and not little_endian)):
20329  * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
20330  * if t == NPY_BYTE: f = "b"
20331  * elif t == NPY_UBYTE: f = "B"
20332  */
20333  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20334  __Pyx_GOTREF(__pyx_t_3);
20335  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
20336  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20337  {__pyx_filename = __pyx_f[1]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20338 
20339  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":257
20340  * if not hasfields:
20341  * t = descr.type_num
20342  * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
20343  * (descr.byteorder == c'<' and not little_endian)):
20344  * raise ValueError(u"Non-native byte order not supported")
20345  */
20346  }
20347 
20348  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":260
20349  * (descr.byteorder == c'<' and not little_endian)):
20350  * raise ValueError(u"Non-native byte order not supported")
20351  * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<<
20352  * elif t == NPY_UBYTE: f = "B"
20353  * elif t == NPY_SHORT: f = "h"
20354  */
20355  switch (__pyx_v_t) {
20356  case NPY_BYTE:
20357  __pyx_v_f = __pyx_k_b;
20358  break;
20359 
20360  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":261
20361  * raise ValueError(u"Non-native byte order not supported")
20362  * if t == NPY_BYTE: f = "b"
20363  * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<<
20364  * elif t == NPY_SHORT: f = "h"
20365  * elif t == NPY_USHORT: f = "H"
20366  */
20367  case NPY_UBYTE:
20368  __pyx_v_f = __pyx_k_B;
20369  break;
20370 
20371  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":262
20372  * if t == NPY_BYTE: f = "b"
20373  * elif t == NPY_UBYTE: f = "B"
20374  * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<<
20375  * elif t == NPY_USHORT: f = "H"
20376  * elif t == NPY_INT: f = "i"
20377  */
20378  case NPY_SHORT:
20379  __pyx_v_f = __pyx_k_h;
20380  break;
20381 
20382  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":263
20383  * elif t == NPY_UBYTE: f = "B"
20384  * elif t == NPY_SHORT: f = "h"
20385  * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<<
20386  * elif t == NPY_INT: f = "i"
20387  * elif t == NPY_UINT: f = "I"
20388  */
20389  case NPY_USHORT:
20390  __pyx_v_f = __pyx_k_H;
20391  break;
20392 
20393  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":264
20394  * elif t == NPY_SHORT: f = "h"
20395  * elif t == NPY_USHORT: f = "H"
20396  * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<<
20397  * elif t == NPY_UINT: f = "I"
20398  * elif t == NPY_LONG: f = "l"
20399  */
20400  case NPY_INT:
20401  __pyx_v_f = __pyx_k_i;
20402  break;
20403 
20404  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":265
20405  * elif t == NPY_USHORT: f = "H"
20406  * elif t == NPY_INT: f = "i"
20407  * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<<
20408  * elif t == NPY_LONG: f = "l"
20409  * elif t == NPY_ULONG: f = "L"
20410  */
20411  case NPY_UINT:
20412  __pyx_v_f = __pyx_k_I;
20413  break;
20414 
20415  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":266
20416  * elif t == NPY_INT: f = "i"
20417  * elif t == NPY_UINT: f = "I"
20418  * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<<
20419  * elif t == NPY_ULONG: f = "L"
20420  * elif t == NPY_LONGLONG: f = "q"
20421  */
20422  case NPY_LONG:
20423  __pyx_v_f = __pyx_k_l;
20424  break;
20425 
20426  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":267
20427  * elif t == NPY_UINT: f = "I"
20428  * elif t == NPY_LONG: f = "l"
20429  * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<<
20430  * elif t == NPY_LONGLONG: f = "q"
20431  * elif t == NPY_ULONGLONG: f = "Q"
20432  */
20433  case NPY_ULONG:
20434  __pyx_v_f = __pyx_k_L;
20435  break;
20436 
20437  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":268
20438  * elif t == NPY_LONG: f = "l"
20439  * elif t == NPY_ULONG: f = "L"
20440  * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<<
20441  * elif t == NPY_ULONGLONG: f = "Q"
20442  * elif t == NPY_FLOAT: f = "f"
20443  */
20444  case NPY_LONGLONG:
20445  __pyx_v_f = __pyx_k_q;
20446  break;
20447 
20448  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":269
20449  * elif t == NPY_ULONG: f = "L"
20450  * elif t == NPY_LONGLONG: f = "q"
20451  * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<<
20452  * elif t == NPY_FLOAT: f = "f"
20453  * elif t == NPY_DOUBLE: f = "d"
20454  */
20455  case NPY_ULONGLONG:
20456  __pyx_v_f = __pyx_k_Q;
20457  break;
20458 
20459  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":270
20460  * elif t == NPY_LONGLONG: f = "q"
20461  * elif t == NPY_ULONGLONG: f = "Q"
20462  * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<<
20463  * elif t == NPY_DOUBLE: f = "d"
20464  * elif t == NPY_LONGDOUBLE: f = "g"
20465  */
20466  case NPY_FLOAT:
20467  __pyx_v_f = __pyx_k_f;
20468  break;
20469 
20470  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":271
20471  * elif t == NPY_ULONGLONG: f = "Q"
20472  * elif t == NPY_FLOAT: f = "f"
20473  * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<<
20474  * elif t == NPY_LONGDOUBLE: f = "g"
20475  * elif t == NPY_CFLOAT: f = "Zf"
20476  */
20477  case NPY_DOUBLE:
20478  __pyx_v_f = __pyx_k_d;
20479  break;
20480 
20481  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":272
20482  * elif t == NPY_FLOAT: f = "f"
20483  * elif t == NPY_DOUBLE: f = "d"
20484  * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<<
20485  * elif t == NPY_CFLOAT: f = "Zf"
20486  * elif t == NPY_CDOUBLE: f = "Zd"
20487  */
20488  case NPY_LONGDOUBLE:
20489  __pyx_v_f = __pyx_k_g;
20490  break;
20491 
20492  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":273
20493  * elif t == NPY_DOUBLE: f = "d"
20494  * elif t == NPY_LONGDOUBLE: f = "g"
20495  * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<<
20496  * elif t == NPY_CDOUBLE: f = "Zd"
20497  * elif t == NPY_CLONGDOUBLE: f = "Zg"
20498  */
20499  case NPY_CFLOAT:
20500  __pyx_v_f = __pyx_k_Zf;
20501  break;
20502 
20503  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":274
20504  * elif t == NPY_LONGDOUBLE: f = "g"
20505  * elif t == NPY_CFLOAT: f = "Zf"
20506  * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<<
20507  * elif t == NPY_CLONGDOUBLE: f = "Zg"
20508  * elif t == NPY_OBJECT: f = "O"
20509  */
20510  case NPY_CDOUBLE:
20511  __pyx_v_f = __pyx_k_Zd;
20512  break;
20513 
20514  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":275
20515  * elif t == NPY_CFLOAT: f = "Zf"
20516  * elif t == NPY_CDOUBLE: f = "Zd"
20517  * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<<
20518  * elif t == NPY_OBJECT: f = "O"
20519  * else:
20520  */
20521  case NPY_CLONGDOUBLE:
20522  __pyx_v_f = __pyx_k_Zg;
20523  break;
20524 
20525  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":276
20526  * elif t == NPY_CDOUBLE: f = "Zd"
20527  * elif t == NPY_CLONGDOUBLE: f = "Zg"
20528  * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<<
20529  * else:
20530  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
20531  */
20532  case NPY_OBJECT:
20533  __pyx_v_f = __pyx_k_O;
20534  break;
20535  default:
20536 
20537  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":278
20538  * elif t == NPY_OBJECT: f = "O"
20539  * else:
20540  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
20541  * info.format = f
20542  * return
20543  */
20544  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20545  __Pyx_GOTREF(__pyx_t_3);
20546  __pyx_t_6 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20547  __Pyx_GOTREF(__pyx_t_6);
20548  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20549  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20550  __Pyx_GOTREF(__pyx_t_3);
20551  __Pyx_GIVEREF(__pyx_t_6);
20552  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6);
20553  __pyx_t_6 = 0;
20554  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20555  __Pyx_GOTREF(__pyx_t_6);
20556  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20557  __Pyx_Raise(__pyx_t_6, 0, 0, 0);
20558  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20559  {__pyx_filename = __pyx_f[1]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20560  break;
20561  }
20562 
20563  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":279
20564  * else:
20565  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
20566  * info.format = f # <<<<<<<<<<<<<<
20567  * return
20568  * else:
20569  */
20570  __pyx_v_info->format = __pyx_v_f;
20571 
20572  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":280
20573  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
20574  * info.format = f
20575  * return # <<<<<<<<<<<<<<
20576  * else:
20577  * info.format = <char*>stdlib.malloc(_buffer_format_string_len)
20578  */
20579  __pyx_r = 0;
20580  goto __pyx_L0;
20581 
20582  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":255
20583  * info.obj = self
20584  *
20585  * if not hasfields: # <<<<<<<<<<<<<<
20586  * t = descr.type_num
20587  * if ((descr.byteorder == c'>' and little_endian) or
20588  */
20589  }
20590 
20591  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":282
20592  * return
20593  * else:
20594  * info.format = <char*>stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<<
20595  * info.format[0] = c'^' # Native data types, manual alignment
20596  * offset = 0
20597  */
20598  /*else*/ {
20599  __pyx_v_info->format = ((char *)malloc(0xFF));
20600 
20601  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":283
20602  * else:
20603  * info.format = <char*>stdlib.malloc(_buffer_format_string_len)
20604  * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<<
20605  * offset = 0
20606  * f = _util_dtypestring(descr, info.format + 1,
20607  */
20608  (__pyx_v_info->format[0]) = '^';
20609 
20610  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":284
20611  * info.format = <char*>stdlib.malloc(_buffer_format_string_len)
20612  * info.format[0] = c'^' # Native data types, manual alignment
20613  * offset = 0 # <<<<<<<<<<<<<<
20614  * f = _util_dtypestring(descr, info.format + 1,
20615  * info.format + _buffer_format_string_len,
20616  */
20617  __pyx_v_offset = 0;
20618 
20619  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":285
20620  * info.format[0] = c'^' # Native data types, manual alignment
20621  * offset = 0
20622  * f = _util_dtypestring(descr, info.format + 1, # <<<<<<<<<<<<<<
20623  * info.format + _buffer_format_string_len,
20624  * &offset)
20625  */
20626  __pyx_t_7 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20627  __pyx_v_f = __pyx_t_7;
20628 
20629  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":288
20630  * info.format + _buffer_format_string_len,
20631  * &offset)
20632  * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<<
20633  *
20634  * def __releasebuffer__(ndarray self, Py_buffer* info):
20635  */
20636  (__pyx_v_f[0]) = '\x00';
20637  }
20638 
20639  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":197
20640  * # experimental exception made for __getbuffer__ and __releasebuffer__
20641  * # -- the details of this may change.
20642  * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
20643  * # This implementation of getbuffer is geared towards Cython
20644  * # requirements, and does not yet fullfill the PEP.
20645  */
20646 
20647  /* function exit code */
20648  __pyx_r = 0;
20649  goto __pyx_L0;
20650  __pyx_L1_error:;
20651  __Pyx_XDECREF(__pyx_t_3);
20652  __Pyx_XDECREF(__pyx_t_6);
20653  __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
20654  __pyx_r = -1;
20655  if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) {
20656  __Pyx_GOTREF(__pyx_v_info->obj);
20657  __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL;
20658  }
20659  goto __pyx_L2;
20660  __pyx_L0:;
20661  if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) {
20662  __Pyx_GOTREF(Py_None);
20663  __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
20664  }
20665  __pyx_L2:;
20666  __Pyx_XDECREF((PyObject *)__pyx_v_descr);
20667  __Pyx_RefNannyFinishContext();
20668  return __pyx_r;
20669 }
20670 
20671 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":290
20672  * f[0] = c'\0' # Terminate format string
20673  *
20674  * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
20675  * if PyArray_HASFIELDS(self):
20676  * stdlib.free(info.format)
20677  */
20678 
20679 /* Python wrapper */
20680 static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
20681 static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
20682  __Pyx_RefNannyDeclarations
20683  __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
20684  __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
20685 
20686  /* function exit code */
20687  __Pyx_RefNannyFinishContext();
20688 }
20689 
20690 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
20691  __Pyx_RefNannyDeclarations
20692  int __pyx_t_1;
20693  __Pyx_RefNannySetupContext("__releasebuffer__", 0);
20694 
20695  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":291
20696  *
20697  * def __releasebuffer__(ndarray self, Py_buffer* info):
20698  * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
20699  * stdlib.free(info.format)
20700  * if sizeof(npy_intp) != sizeof(Py_ssize_t):
20701  */
20702  __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
20703  if (__pyx_t_1) {
20704 
20705  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":292
20706  * def __releasebuffer__(ndarray self, Py_buffer* info):
20707  * if PyArray_HASFIELDS(self):
20708  * stdlib.free(info.format) # <<<<<<<<<<<<<<
20709  * if sizeof(npy_intp) != sizeof(Py_ssize_t):
20710  * stdlib.free(info.strides)
20711  */
20712  free(__pyx_v_info->format);
20713 
20714  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":291
20715  *
20716  * def __releasebuffer__(ndarray self, Py_buffer* info):
20717  * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
20718  * stdlib.free(info.format)
20719  * if sizeof(npy_intp) != sizeof(Py_ssize_t):
20720  */
20721  }
20722 
20723  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":293
20724  * if PyArray_HASFIELDS(self):
20725  * stdlib.free(info.format)
20726  * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
20727  * stdlib.free(info.strides)
20728  * # info.shape was stored after info.strides in the same block
20729  */
20730  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
20731  if (__pyx_t_1) {
20732 
20733  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":294
20734  * stdlib.free(info.format)
20735  * if sizeof(npy_intp) != sizeof(Py_ssize_t):
20736  * stdlib.free(info.strides) # <<<<<<<<<<<<<<
20737  * # info.shape was stored after info.strides in the same block
20738  *
20739  */
20740  free(__pyx_v_info->strides);
20741 
20742  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":293
20743  * if PyArray_HASFIELDS(self):
20744  * stdlib.free(info.format)
20745  * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
20746  * stdlib.free(info.strides)
20747  * # info.shape was stored after info.strides in the same block
20748  */
20749  }
20750 
20751  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":290
20752  * f[0] = c'\0' # Terminate format string
20753  *
20754  * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
20755  * if PyArray_HASFIELDS(self):
20756  * stdlib.free(info.format)
20757  */
20758 
20759  /* function exit code */
20760  __Pyx_RefNannyFinishContext();
20761 }
20762 
20763 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":770
20764  * ctypedef npy_cdouble complex_t
20765  *
20766  * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
20767  * return PyArray_MultiIterNew(1, <void*>a)
20768  *
20769  */
20770 
20771 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
20772  PyObject *__pyx_r = NULL;
20773  __Pyx_RefNannyDeclarations
20774  PyObject *__pyx_t_1 = NULL;
20775  int __pyx_lineno = 0;
20776  const char *__pyx_filename = NULL;
20777  int __pyx_clineno = 0;
20778  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
20779 
20780  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":771
20781  *
20782  * cdef inline object PyArray_MultiIterNew1(a):
20783  * return PyArray_MultiIterNew(1, <void*>a) # <<<<<<<<<<<<<<
20784  *
20785  * cdef inline object PyArray_MultiIterNew2(a, b):
20786  */
20787  __Pyx_XDECREF(__pyx_r);
20788  __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20789  __Pyx_GOTREF(__pyx_t_1);
20790  __pyx_r = __pyx_t_1;
20791  __pyx_t_1 = 0;
20792  goto __pyx_L0;
20793 
20794  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":770
20795  * ctypedef npy_cdouble complex_t
20796  *
20797  * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
20798  * return PyArray_MultiIterNew(1, <void*>a)
20799  *
20800  */
20801 
20802  /* function exit code */
20803  __pyx_L1_error:;
20804  __Pyx_XDECREF(__pyx_t_1);
20805  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
20806  __pyx_r = 0;
20807  __pyx_L0:;
20808  __Pyx_XGIVEREF(__pyx_r);
20809  __Pyx_RefNannyFinishContext();
20810  return __pyx_r;
20811 }
20812 
20813 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":773
20814  * return PyArray_MultiIterNew(1, <void*>a)
20815  *
20816  * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
20817  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
20818  *
20819  */
20820 
20821 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
20822  PyObject *__pyx_r = NULL;
20823  __Pyx_RefNannyDeclarations
20824  PyObject *__pyx_t_1 = NULL;
20825  int __pyx_lineno = 0;
20826  const char *__pyx_filename = NULL;
20827  int __pyx_clineno = 0;
20828  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
20829 
20830  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":774
20831  *
20832  * cdef inline object PyArray_MultiIterNew2(a, b):
20833  * return PyArray_MultiIterNew(2, <void*>a, <void*>b) # <<<<<<<<<<<<<<
20834  *
20835  * cdef inline object PyArray_MultiIterNew3(a, b, c):
20836  */
20837  __Pyx_XDECREF(__pyx_r);
20838  __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20839  __Pyx_GOTREF(__pyx_t_1);
20840  __pyx_r = __pyx_t_1;
20841  __pyx_t_1 = 0;
20842  goto __pyx_L0;
20843 
20844  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":773
20845  * return PyArray_MultiIterNew(1, <void*>a)
20846  *
20847  * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
20848  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
20849  *
20850  */
20851 
20852  /* function exit code */
20853  __pyx_L1_error:;
20854  __Pyx_XDECREF(__pyx_t_1);
20855  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
20856  __pyx_r = 0;
20857  __pyx_L0:;
20858  __Pyx_XGIVEREF(__pyx_r);
20859  __Pyx_RefNannyFinishContext();
20860  return __pyx_r;
20861 }
20862 
20863 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":776
20864  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
20865  *
20866  * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
20867  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
20868  *
20869  */
20870 
20871 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
20872  PyObject *__pyx_r = NULL;
20873  __Pyx_RefNannyDeclarations
20874  PyObject *__pyx_t_1 = NULL;
20875  int __pyx_lineno = 0;
20876  const char *__pyx_filename = NULL;
20877  int __pyx_clineno = 0;
20878  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
20879 
20880  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":777
20881  *
20882  * cdef inline object PyArray_MultiIterNew3(a, b, c):
20883  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) # <<<<<<<<<<<<<<
20884  *
20885  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
20886  */
20887  __Pyx_XDECREF(__pyx_r);
20888  __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20889  __Pyx_GOTREF(__pyx_t_1);
20890  __pyx_r = __pyx_t_1;
20891  __pyx_t_1 = 0;
20892  goto __pyx_L0;
20893 
20894  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":776
20895  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
20896  *
20897  * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
20898  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
20899  *
20900  */
20901 
20902  /* function exit code */
20903  __pyx_L1_error:;
20904  __Pyx_XDECREF(__pyx_t_1);
20905  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
20906  __pyx_r = 0;
20907  __pyx_L0:;
20908  __Pyx_XGIVEREF(__pyx_r);
20909  __Pyx_RefNannyFinishContext();
20910  return __pyx_r;
20911 }
20912 
20913 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":779
20914  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
20915  *
20916  * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
20917  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
20918  *
20919  */
20920 
20921 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
20922  PyObject *__pyx_r = NULL;
20923  __Pyx_RefNannyDeclarations
20924  PyObject *__pyx_t_1 = NULL;
20925  int __pyx_lineno = 0;
20926  const char *__pyx_filename = NULL;
20927  int __pyx_clineno = 0;
20928  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
20929 
20930  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":780
20931  *
20932  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
20933  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) # <<<<<<<<<<<<<<
20934  *
20935  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
20936  */
20937  __Pyx_XDECREF(__pyx_r);
20938  __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20939  __Pyx_GOTREF(__pyx_t_1);
20940  __pyx_r = __pyx_t_1;
20941  __pyx_t_1 = 0;
20942  goto __pyx_L0;
20943 
20944  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":779
20945  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
20946  *
20947  * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
20948  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
20949  *
20950  */
20951 
20952  /* function exit code */
20953  __pyx_L1_error:;
20954  __Pyx_XDECREF(__pyx_t_1);
20955  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
20956  __pyx_r = 0;
20957  __pyx_L0:;
20958  __Pyx_XGIVEREF(__pyx_r);
20959  __Pyx_RefNannyFinishContext();
20960  return __pyx_r;
20961 }
20962 
20963 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":782
20964  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
20965  *
20966  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
20967  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
20968  *
20969  */
20970 
20971 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
20972  PyObject *__pyx_r = NULL;
20973  __Pyx_RefNannyDeclarations
20974  PyObject *__pyx_t_1 = NULL;
20975  int __pyx_lineno = 0;
20976  const char *__pyx_filename = NULL;
20977  int __pyx_clineno = 0;
20978  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
20979 
20980  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":783
20981  *
20982  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
20983  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) # <<<<<<<<<<<<<<
20984  *
20985  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
20986  */
20987  __Pyx_XDECREF(__pyx_r);
20988  __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20989  __Pyx_GOTREF(__pyx_t_1);
20990  __pyx_r = __pyx_t_1;
20991  __pyx_t_1 = 0;
20992  goto __pyx_L0;
20993 
20994  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":782
20995  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
20996  *
20997  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
20998  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
20999  *
21000  */
21001 
21002  /* function exit code */
21003  __pyx_L1_error:;
21004  __Pyx_XDECREF(__pyx_t_1);
21005  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
21006  __pyx_r = 0;
21007  __pyx_L0:;
21008  __Pyx_XGIVEREF(__pyx_r);
21009  __Pyx_RefNannyFinishContext();
21010  return __pyx_r;
21011 }
21012 
21013 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":785
21014  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
21015  *
21016  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
21017  * # Recursive utility function used in __getbuffer__ to get format
21018  * # string. The new location in the format string is returned.
21019  */
21020 
21021 static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) {
21022  PyArray_Descr *__pyx_v_child = 0;
21023  int __pyx_v_endian_detector;
21024  int __pyx_v_little_endian;
21025  PyObject *__pyx_v_fields = 0;
21026  PyObject *__pyx_v_childname = NULL;
21027  PyObject *__pyx_v_new_offset = NULL;
21028  PyObject *__pyx_v_t = NULL;
21029  char *__pyx_r;
21030  __Pyx_RefNannyDeclarations
21031  PyObject *__pyx_t_1 = NULL;
21032  Py_ssize_t __pyx_t_2;
21033  PyObject *__pyx_t_3 = NULL;
21034  PyObject *__pyx_t_4 = NULL;
21035  int __pyx_t_5;
21036  int __pyx_t_6;
21037  int __pyx_t_7;
21038  long __pyx_t_8;
21039  char *__pyx_t_9;
21040  int __pyx_lineno = 0;
21041  const char *__pyx_filename = NULL;
21042  int __pyx_clineno = 0;
21043  __Pyx_RefNannySetupContext("_util_dtypestring", 0);
21044 
21045  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":790
21046  *
21047  * cdef dtype child
21048  * cdef int endian_detector = 1 # <<<<<<<<<<<<<<
21049  * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
21050  * cdef tuple fields
21051  */
21052  __pyx_v_endian_detector = 1;
21053 
21054  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":791
21055  * cdef dtype child
21056  * cdef int endian_detector = 1
21057  * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
21058  * cdef tuple fields
21059  *
21060  */
21061  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
21062 
21063  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":794
21064  * cdef tuple fields
21065  *
21066  * for childname in descr.names: # <<<<<<<<<<<<<<
21067  * fields = descr.fields[childname]
21068  * child, new_offset = fields
21069  */
21070  if (unlikely(__pyx_v_descr->names == Py_None)) {
21071  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
21072  {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21073  }
21074  __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
21075  for (;;) {
21076  if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
21077  #if CYTHON_COMPILING_IN_CPYTHON
21078  __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21079  #else
21080  __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21081  __Pyx_GOTREF(__pyx_t_3);
21082  #endif
21083  __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
21084  __pyx_t_3 = 0;
21085 
21086  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":795
21087  *
21088  * for childname in descr.names:
21089  * fields = descr.fields[childname] # <<<<<<<<<<<<<<
21090  * child, new_offset = fields
21091  *
21092  */
21093  if (unlikely(__pyx_v_descr->fields == Py_None)) {
21094  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
21095  {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21096  }
21097  __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
21098  __Pyx_GOTREF(__pyx_t_3);
21099  if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21100  __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
21101  __pyx_t_3 = 0;
21102 
21103  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":796
21104  * for childname in descr.names:
21105  * fields = descr.fields[childname]
21106  * child, new_offset = fields # <<<<<<<<<<<<<<
21107  *
21108  * if (end - f) - <int>(new_offset - offset[0]) < 15:
21109  */
21110  if (likely(__pyx_v_fields != Py_None)) {
21111  PyObject* sequence = __pyx_v_fields;
21112  #if CYTHON_COMPILING_IN_CPYTHON
21113  Py_ssize_t size = Py_SIZE(sequence);
21114  #else
21115  Py_ssize_t size = PySequence_Size(sequence);
21116  #endif
21117  if (unlikely(size != 2)) {
21118  if (size > 2) __Pyx_RaiseTooManyValuesError(2);
21119  else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
21120  {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21121  }
21122  #if CYTHON_COMPILING_IN_CPYTHON
21123  __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
21124  __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
21125  __Pyx_INCREF(__pyx_t_3);
21126  __Pyx_INCREF(__pyx_t_4);
21127  #else
21128  __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21129  __Pyx_GOTREF(__pyx_t_3);
21130  __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21131  __Pyx_GOTREF(__pyx_t_4);
21132  #endif
21133  } else {
21134  __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21135  }
21136  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21137  __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
21138  __pyx_t_3 = 0;
21139  __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
21140  __pyx_t_4 = 0;
21141 
21142  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":798
21143  * child, new_offset = fields
21144  *
21145  * if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
21146  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
21147  *
21148  */
21149  __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21150  __Pyx_GOTREF(__pyx_t_4);
21151  __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21152  __Pyx_GOTREF(__pyx_t_3);
21153  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21154  __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21155  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21156  __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0);
21157  if (__pyx_t_6) {
21158 
21159  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":799
21160  *
21161  * if (end - f) - <int>(new_offset - offset[0]) < 15:
21162  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
21163  *
21164  * if ((child.byteorder == c'>' and little_endian) or
21165  */
21166  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21167  __Pyx_GOTREF(__pyx_t_3);
21168  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
21169  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21170  {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21171 
21172  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":798
21173  * child, new_offset = fields
21174  *
21175  * if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
21176  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
21177  *
21178  */
21179  }
21180 
21181  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":801
21182  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
21183  *
21184  * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
21185  * (child.byteorder == c'<' and not little_endian)):
21186  * raise ValueError(u"Non-native byte order not supported")
21187  */
21188  __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
21189  if (!__pyx_t_7) {
21190  goto __pyx_L8_next_or;
21191  } else {
21192  }
21193  __pyx_t_7 = (__pyx_v_little_endian != 0);
21194  if (!__pyx_t_7) {
21195  } else {
21196  __pyx_t_6 = __pyx_t_7;
21197  goto __pyx_L7_bool_binop_done;
21198  }
21199  __pyx_L8_next_or:;
21200 
21201  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":802
21202  *
21203  * if ((child.byteorder == c'>' and little_endian) or
21204  * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
21205  * raise ValueError(u"Non-native byte order not supported")
21206  * # One could encode it in the format string and have Cython
21207  */
21208  __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
21209  if (__pyx_t_7) {
21210  } else {
21211  __pyx_t_6 = __pyx_t_7;
21212  goto __pyx_L7_bool_binop_done;
21213  }
21214  __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
21215  __pyx_t_6 = __pyx_t_7;
21216  __pyx_L7_bool_binop_done:;
21217 
21218  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":801
21219  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
21220  *
21221  * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
21222  * (child.byteorder == c'<' and not little_endian)):
21223  * raise ValueError(u"Non-native byte order not supported")
21224  */
21225  if (__pyx_t_6) {
21226 
21227  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":803
21228  * if ((child.byteorder == c'>' and little_endian) or
21229  * (child.byteorder == c'<' and not little_endian)):
21230  * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
21231  * # One could encode it in the format string and have Cython
21232  * # complain instead, BUT: < and > in format strings also imply
21233  */
21234  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21235  __Pyx_GOTREF(__pyx_t_3);
21236  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
21237  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21238  {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21239 
21240  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":801
21241  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
21242  *
21243  * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
21244  * (child.byteorder == c'<' and not little_endian)):
21245  * raise ValueError(u"Non-native byte order not supported")
21246  */
21247  }
21248 
21249  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":813
21250  *
21251  * # Output padding bytes
21252  * while offset[0] < new_offset: # <<<<<<<<<<<<<<
21253  * f[0] = 120 # "x"; pad byte
21254  * f += 1
21255  */
21256  while (1) {
21257  __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21258  __Pyx_GOTREF(__pyx_t_3);
21259  __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21260  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21261  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21262  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21263  if (!__pyx_t_6) break;
21264 
21265  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":814
21266  * # Output padding bytes
21267  * while offset[0] < new_offset:
21268  * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<<
21269  * f += 1
21270  * offset[0] += 1
21271  */
21272  (__pyx_v_f[0]) = 0x78;
21273 
21274  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":815
21275  * while offset[0] < new_offset:
21276  * f[0] = 120 # "x"; pad byte
21277  * f += 1 # <<<<<<<<<<<<<<
21278  * offset[0] += 1
21279  *
21280  */
21281  __pyx_v_f = (__pyx_v_f + 1);
21282 
21283  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":816
21284  * f[0] = 120 # "x"; pad byte
21285  * f += 1
21286  * offset[0] += 1 # <<<<<<<<<<<<<<
21287  *
21288  * offset[0] += child.itemsize
21289  */
21290  __pyx_t_8 = 0;
21291  (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
21292  }
21293 
21294  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":818
21295  * offset[0] += 1
21296  *
21297  * offset[0] += child.itemsize # <<<<<<<<<<<<<<
21298  *
21299  * if not PyDataType_HASFIELDS(child):
21300  */
21301  __pyx_t_8 = 0;
21302  (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);
21303 
21304  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":820
21305  * offset[0] += child.itemsize
21306  *
21307  * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
21308  * t = child.type_num
21309  * if end - f < 5:
21310  */
21311  __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
21312  if (__pyx_t_6) {
21313 
21314  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":821
21315  *
21316  * if not PyDataType_HASFIELDS(child):
21317  * t = child.type_num # <<<<<<<<<<<<<<
21318  * if end - f < 5:
21319  * raise RuntimeError(u"Format string allocated too short.")
21320  */
21321  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21322  __Pyx_GOTREF(__pyx_t_4);
21323  __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
21324  __pyx_t_4 = 0;
21325 
21326  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":822
21327  * if not PyDataType_HASFIELDS(child):
21328  * t = child.type_num
21329  * if end - f < 5: # <<<<<<<<<<<<<<
21330  * raise RuntimeError(u"Format string allocated too short.")
21331  *
21332  */
21333  __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
21334  if (__pyx_t_6) {
21335 
21336  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":823
21337  * t = child.type_num
21338  * if end - f < 5:
21339  * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
21340  *
21341  * # Until ticket #99 is fixed, use integers to avoid warnings
21342  */
21343  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21344  __Pyx_GOTREF(__pyx_t_4);
21345  __Pyx_Raise(__pyx_t_4, 0, 0, 0);
21346  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21347  {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21348 
21349  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":822
21350  * if not PyDataType_HASFIELDS(child):
21351  * t = child.type_num
21352  * if end - f < 5: # <<<<<<<<<<<<<<
21353  * raise RuntimeError(u"Format string allocated too short.")
21354  *
21355  */
21356  }
21357 
21358  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":826
21359  *
21360  * # Until ticket #99 is fixed, use integers to avoid warnings
21361  * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<<
21362  * elif t == NPY_UBYTE: f[0] = 66 #"B"
21363  * elif t == NPY_SHORT: f[0] = 104 #"h"
21364  */
21365  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21366  __Pyx_GOTREF(__pyx_t_4);
21367  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21368  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21369  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21370  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21371  if (__pyx_t_6) {
21372  (__pyx_v_f[0]) = 98;
21373  goto __pyx_L15;
21374  }
21375 
21376  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":827
21377  * # Until ticket #99 is fixed, use integers to avoid warnings
21378  * if t == NPY_BYTE: f[0] = 98 #"b"
21379  * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<<
21380  * elif t == NPY_SHORT: f[0] = 104 #"h"
21381  * elif t == NPY_USHORT: f[0] = 72 #"H"
21382  */
21383  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21384  __Pyx_GOTREF(__pyx_t_3);
21385  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21386  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21387  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21388  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21389  if (__pyx_t_6) {
21390  (__pyx_v_f[0]) = 66;
21391  goto __pyx_L15;
21392  }
21393 
21394  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":828
21395  * if t == NPY_BYTE: f[0] = 98 #"b"
21396  * elif t == NPY_UBYTE: f[0] = 66 #"B"
21397  * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<<
21398  * elif t == NPY_USHORT: f[0] = 72 #"H"
21399  * elif t == NPY_INT: f[0] = 105 #"i"
21400  */
21401  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21402  __Pyx_GOTREF(__pyx_t_4);
21403  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21404  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21405  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21406  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21407  if (__pyx_t_6) {
21408  (__pyx_v_f[0]) = 0x68;
21409  goto __pyx_L15;
21410  }
21411 
21412  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":829
21413  * elif t == NPY_UBYTE: f[0] = 66 #"B"
21414  * elif t == NPY_SHORT: f[0] = 104 #"h"
21415  * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<<
21416  * elif t == NPY_INT: f[0] = 105 #"i"
21417  * elif t == NPY_UINT: f[0] = 73 #"I"
21418  */
21419  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21420  __Pyx_GOTREF(__pyx_t_3);
21421  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21422  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21423  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21424  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21425  if (__pyx_t_6) {
21426  (__pyx_v_f[0]) = 72;
21427  goto __pyx_L15;
21428  }
21429 
21430  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":830
21431  * elif t == NPY_SHORT: f[0] = 104 #"h"
21432  * elif t == NPY_USHORT: f[0] = 72 #"H"
21433  * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<<
21434  * elif t == NPY_UINT: f[0] = 73 #"I"
21435  * elif t == NPY_LONG: f[0] = 108 #"l"
21436  */
21437  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21438  __Pyx_GOTREF(__pyx_t_4);
21439  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21440  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21441  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21442  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21443  if (__pyx_t_6) {
21444  (__pyx_v_f[0]) = 0x69;
21445  goto __pyx_L15;
21446  }
21447 
21448  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":831
21449  * elif t == NPY_USHORT: f[0] = 72 #"H"
21450  * elif t == NPY_INT: f[0] = 105 #"i"
21451  * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<<
21452  * elif t == NPY_LONG: f[0] = 108 #"l"
21453  * elif t == NPY_ULONG: f[0] = 76 #"L"
21454  */
21455  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21456  __Pyx_GOTREF(__pyx_t_3);
21457  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21458  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21459  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21460  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21461  if (__pyx_t_6) {
21462  (__pyx_v_f[0]) = 73;
21463  goto __pyx_L15;
21464  }
21465 
21466  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":832
21467  * elif t == NPY_INT: f[0] = 105 #"i"
21468  * elif t == NPY_UINT: f[0] = 73 #"I"
21469  * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<<
21470  * elif t == NPY_ULONG: f[0] = 76 #"L"
21471  * elif t == NPY_LONGLONG: f[0] = 113 #"q"
21472  */
21473  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21474  __Pyx_GOTREF(__pyx_t_4);
21475  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21476  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21477  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21478  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21479  if (__pyx_t_6) {
21480  (__pyx_v_f[0]) = 0x6C;
21481  goto __pyx_L15;
21482  }
21483 
21484  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":833
21485  * elif t == NPY_UINT: f[0] = 73 #"I"
21486  * elif t == NPY_LONG: f[0] = 108 #"l"
21487  * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<<
21488  * elif t == NPY_LONGLONG: f[0] = 113 #"q"
21489  * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
21490  */
21491  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21492  __Pyx_GOTREF(__pyx_t_3);
21493  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21494  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21495  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21496  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21497  if (__pyx_t_6) {
21498  (__pyx_v_f[0]) = 76;
21499  goto __pyx_L15;
21500  }
21501 
21502  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":834
21503  * elif t == NPY_LONG: f[0] = 108 #"l"
21504  * elif t == NPY_ULONG: f[0] = 76 #"L"
21505  * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<<
21506  * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
21507  * elif t == NPY_FLOAT: f[0] = 102 #"f"
21508  */
21509  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21510  __Pyx_GOTREF(__pyx_t_4);
21511  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21512  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21513  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21514  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21515  if (__pyx_t_6) {
21516  (__pyx_v_f[0]) = 0x71;
21517  goto __pyx_L15;
21518  }
21519 
21520  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":835
21521  * elif t == NPY_ULONG: f[0] = 76 #"L"
21522  * elif t == NPY_LONGLONG: f[0] = 113 #"q"
21523  * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<<
21524  * elif t == NPY_FLOAT: f[0] = 102 #"f"
21525  * elif t == NPY_DOUBLE: f[0] = 100 #"d"
21526  */
21527  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21528  __Pyx_GOTREF(__pyx_t_3);
21529  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21530  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21531  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21532  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21533  if (__pyx_t_6) {
21534  (__pyx_v_f[0]) = 81;
21535  goto __pyx_L15;
21536  }
21537 
21538  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":836
21539  * elif t == NPY_LONGLONG: f[0] = 113 #"q"
21540  * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
21541  * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<<
21542  * elif t == NPY_DOUBLE: f[0] = 100 #"d"
21543  * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
21544  */
21545  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21546  __Pyx_GOTREF(__pyx_t_4);
21547  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21548  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21549  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21550  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21551  if (__pyx_t_6) {
21552  (__pyx_v_f[0]) = 0x66;
21553  goto __pyx_L15;
21554  }
21555 
21556  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":837
21557  * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
21558  * elif t == NPY_FLOAT: f[0] = 102 #"f"
21559  * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<<
21560  * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
21561  * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
21562  */
21563  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21564  __Pyx_GOTREF(__pyx_t_3);
21565  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21566  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21567  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21568  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21569  if (__pyx_t_6) {
21570  (__pyx_v_f[0]) = 0x64;
21571  goto __pyx_L15;
21572  }
21573 
21574  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":838
21575  * elif t == NPY_FLOAT: f[0] = 102 #"f"
21576  * elif t == NPY_DOUBLE: f[0] = 100 #"d"
21577  * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<<
21578  * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
21579  * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
21580  */
21581  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21582  __Pyx_GOTREF(__pyx_t_4);
21583  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21584  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21585  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21586  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21587  if (__pyx_t_6) {
21588  (__pyx_v_f[0]) = 0x67;
21589  goto __pyx_L15;
21590  }
21591 
21592  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":839
21593  * elif t == NPY_DOUBLE: f[0] = 100 #"d"
21594  * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
21595  * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<<
21596  * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
21597  * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
21598  */
21599  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21600  __Pyx_GOTREF(__pyx_t_3);
21601  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21602  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21603  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21604  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21605  if (__pyx_t_6) {
21606  (__pyx_v_f[0]) = 90;
21607  (__pyx_v_f[1]) = 0x66;
21608  __pyx_v_f = (__pyx_v_f + 1);
21609  goto __pyx_L15;
21610  }
21611 
21612  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":840
21613  * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
21614  * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
21615  * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<<
21616  * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
21617  * elif t == NPY_OBJECT: f[0] = 79 #"O"
21618  */
21619  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21620  __Pyx_GOTREF(__pyx_t_4);
21621  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21622  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21623  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21624  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21625  if (__pyx_t_6) {
21626  (__pyx_v_f[0]) = 90;
21627  (__pyx_v_f[1]) = 0x64;
21628  __pyx_v_f = (__pyx_v_f + 1);
21629  goto __pyx_L15;
21630  }
21631 
21632  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":841
21633  * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
21634  * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
21635  * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<<
21636  * elif t == NPY_OBJECT: f[0] = 79 #"O"
21637  * else:
21638  */
21639  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21640  __Pyx_GOTREF(__pyx_t_3);
21641  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21642  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21643  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21644  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21645  if (__pyx_t_6) {
21646  (__pyx_v_f[0]) = 90;
21647  (__pyx_v_f[1]) = 0x67;
21648  __pyx_v_f = (__pyx_v_f + 1);
21649  goto __pyx_L15;
21650  }
21651 
21652  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":842
21653  * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
21654  * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
21655  * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<<
21656  * else:
21657  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
21658  */
21659  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21660  __Pyx_GOTREF(__pyx_t_4);
21661  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21662  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21663  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21664  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21665  if (__pyx_t_6) {
21666  (__pyx_v_f[0]) = 79;
21667  goto __pyx_L15;
21668  }
21669 
21670  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":844
21671  * elif t == NPY_OBJECT: f[0] = 79 #"O"
21672  * else:
21673  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
21674  * f += 1
21675  * else:
21676  */
21677  /*else*/ {
21678  __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21679  __Pyx_GOTREF(__pyx_t_3);
21680  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21681  __Pyx_GOTREF(__pyx_t_4);
21682  __Pyx_GIVEREF(__pyx_t_3);
21683  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
21684  __pyx_t_3 = 0;
21685  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21686  __Pyx_GOTREF(__pyx_t_3);
21687  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21688  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
21689  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21690  {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21691  }
21692  __pyx_L15:;
21693 
21694  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":845
21695  * else:
21696  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
21697  * f += 1 # <<<<<<<<<<<<<<
21698  * else:
21699  * # Cython ignores struct boundary information ("T{...}"),
21700  */
21701  __pyx_v_f = (__pyx_v_f + 1);
21702 
21703  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":820
21704  * offset[0] += child.itemsize
21705  *
21706  * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
21707  * t = child.type_num
21708  * if end - f < 5:
21709  */
21710  goto __pyx_L13;
21711  }
21712 
21713  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":849
21714  * # Cython ignores struct boundary information ("T{...}"),
21715  * # so don't output it
21716  * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<<
21717  * return f
21718  *
21719  */
21720  /*else*/ {
21721  __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21722  __pyx_v_f = __pyx_t_9;
21723  }
21724  __pyx_L13:;
21725 
21726  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":794
21727  * cdef tuple fields
21728  *
21729  * for childname in descr.names: # <<<<<<<<<<<<<<
21730  * fields = descr.fields[childname]
21731  * child, new_offset = fields
21732  */
21733  }
21734  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21735 
21736  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":850
21737  * # so don't output it
21738  * f = _util_dtypestring(child, f, end, offset)
21739  * return f # <<<<<<<<<<<<<<
21740  *
21741  *
21742  */
21743  __pyx_r = __pyx_v_f;
21744  goto __pyx_L0;
21745 
21746  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":785
21747  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
21748  *
21749  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
21750  * # Recursive utility function used in __getbuffer__ to get format
21751  * # string. The new location in the format string is returned.
21752  */
21753 
21754  /* function exit code */
21755  __pyx_L1_error:;
21756  __Pyx_XDECREF(__pyx_t_1);
21757  __Pyx_XDECREF(__pyx_t_3);
21758  __Pyx_XDECREF(__pyx_t_4);
21759  __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
21760  __pyx_r = NULL;
21761  __pyx_L0:;
21762  __Pyx_XDECREF((PyObject *)__pyx_v_child);
21763  __Pyx_XDECREF(__pyx_v_fields);
21764  __Pyx_XDECREF(__pyx_v_childname);
21765  __Pyx_XDECREF(__pyx_v_new_offset);
21766  __Pyx_XDECREF(__pyx_v_t);
21767  __Pyx_RefNannyFinishContext();
21768  return __pyx_r;
21769 }
21770 
21771 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":966
21772  *
21773  *
21774  * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
21775  * cdef PyObject* baseptr
21776  * if base is None:
21777  */
21778 
21779 static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
21780  PyObject *__pyx_v_baseptr;
21781  __Pyx_RefNannyDeclarations
21782  int __pyx_t_1;
21783  int __pyx_t_2;
21784  __Pyx_RefNannySetupContext("set_array_base", 0);
21785 
21786  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":968
21787  * cdef inline void set_array_base(ndarray arr, object base):
21788  * cdef PyObject* baseptr
21789  * if base is None: # <<<<<<<<<<<<<<
21790  * baseptr = NULL
21791  * else:
21792  */
21793  __pyx_t_1 = (__pyx_v_base == Py_None);
21794  __pyx_t_2 = (__pyx_t_1 != 0);
21795  if (__pyx_t_2) {
21796 
21797  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":969
21798  * cdef PyObject* baseptr
21799  * if base is None:
21800  * baseptr = NULL # <<<<<<<<<<<<<<
21801  * else:
21802  * Py_INCREF(base) # important to do this before decref below!
21803  */
21804  __pyx_v_baseptr = NULL;
21805 
21806  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":968
21807  * cdef inline void set_array_base(ndarray arr, object base):
21808  * cdef PyObject* baseptr
21809  * if base is None: # <<<<<<<<<<<<<<
21810  * baseptr = NULL
21811  * else:
21812  */
21813  goto __pyx_L3;
21814  }
21815 
21816  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":971
21817  * baseptr = NULL
21818  * else:
21819  * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<<
21820  * baseptr = <PyObject*>base
21821  * Py_XDECREF(arr.base)
21822  */
21823  /*else*/ {
21824  Py_INCREF(__pyx_v_base);
21825 
21826  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":972
21827  * else:
21828  * Py_INCREF(base) # important to do this before decref below!
21829  * baseptr = <PyObject*>base # <<<<<<<<<<<<<<
21830  * Py_XDECREF(arr.base)
21831  * arr.base = baseptr
21832  */
21833  __pyx_v_baseptr = ((PyObject *)__pyx_v_base);
21834  }
21835  __pyx_L3:;
21836 
21837  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":973
21838  * Py_INCREF(base) # important to do this before decref below!
21839  * baseptr = <PyObject*>base
21840  * Py_XDECREF(arr.base) # <<<<<<<<<<<<<<
21841  * arr.base = baseptr
21842  *
21843  */
21844  Py_XDECREF(__pyx_v_arr->base);
21845 
21846  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":974
21847  * baseptr = <PyObject*>base
21848  * Py_XDECREF(arr.base)
21849  * arr.base = baseptr # <<<<<<<<<<<<<<
21850  *
21851  * cdef inline object get_array_base(ndarray arr):
21852  */
21853  __pyx_v_arr->base = __pyx_v_baseptr;
21854 
21855  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":966
21856  *
21857  *
21858  * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
21859  * cdef PyObject* baseptr
21860  * if base is None:
21861  */
21862 
21863  /* function exit code */
21864  __Pyx_RefNannyFinishContext();
21865 }
21866 
21867 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":976
21868  * arr.base = baseptr
21869  *
21870  * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
21871  * if arr.base is NULL:
21872  * return None
21873  */
21874 
21875 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
21876  PyObject *__pyx_r = NULL;
21877  __Pyx_RefNannyDeclarations
21878  int __pyx_t_1;
21879  __Pyx_RefNannySetupContext("get_array_base", 0);
21880 
21881  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":977
21882  *
21883  * cdef inline object get_array_base(ndarray arr):
21884  * if arr.base is NULL: # <<<<<<<<<<<<<<
21885  * return None
21886  * else:
21887  */
21888  __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0);
21889  if (__pyx_t_1) {
21890 
21891  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":978
21892  * cdef inline object get_array_base(ndarray arr):
21893  * if arr.base is NULL:
21894  * return None # <<<<<<<<<<<<<<
21895  * else:
21896  * return <object>arr.base
21897  */
21898  __Pyx_XDECREF(__pyx_r);
21899  __Pyx_INCREF(Py_None);
21900  __pyx_r = Py_None;
21901  goto __pyx_L0;
21902 
21903  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":977
21904  *
21905  * cdef inline object get_array_base(ndarray arr):
21906  * if arr.base is NULL: # <<<<<<<<<<<<<<
21907  * return None
21908  * else:
21909  */
21910  }
21911 
21912  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":980
21913  * return None
21914  * else:
21915  * return <object>arr.base # <<<<<<<<<<<<<<
21916  */
21917  /*else*/ {
21918  __Pyx_XDECREF(__pyx_r);
21919  __Pyx_INCREF(((PyObject *)__pyx_v_arr->base));
21920  __pyx_r = ((PyObject *)__pyx_v_arr->base);
21921  goto __pyx_L0;
21922  }
21923 
21924  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":976
21925  * arr.base = baseptr
21926  *
21927  * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
21928  * if arr.base is NULL:
21929  * return None
21930  */
21931 
21932  /* function exit code */
21933  __pyx_L0:;
21934  __Pyx_XGIVEREF(__pyx_r);
21935  __Pyx_RefNannyFinishContext();
21936  return __pyx_r;
21937 }
21938 
21939 static PyMethodDef __pyx_methods[] = {
21940  {0, 0, 0, 0}
21941 };
21942 
21943 #if PY_MAJOR_VERSION >= 3
21944 static struct PyModuleDef __pyx_moduledef = {
21945  #if PY_VERSION_HEX < 0x03020000
21946  { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
21947  #else
21948  PyModuleDef_HEAD_INIT,
21949  #endif
21950  "subsurfaceTransportFunctions",
21951  0, /* m_doc */
21952  -1, /* m_size */
21953  __pyx_methods /* m_methods */,
21954  NULL, /* m_reload */
21955  NULL, /* m_traverse */
21956  NULL, /* m_clear */
21957  NULL /* m_free */
21958 };
21959 #endif
21960 
21961 static __Pyx_StringTabEntry __pyx_string_tab[] = {
21962  {&__pyx_n_s_DKWr_DpsiC, __pyx_k_DKWr_DpsiC, sizeof(__pyx_k_DKWr_DpsiC), 0, 0, 1, 1},
21963  {&__pyx_n_s_DsBar_DpsiC, __pyx_k_DsBar_DpsiC, sizeof(__pyx_k_DsBar_DpsiC), 0, 0, 1, 1},
21964  {&__pyx_n_s_DthetaW_DpsiC, __pyx_k_DthetaW_DpsiC, sizeof(__pyx_k_DthetaW_DpsiC), 0, 0, 1, 1},
21965  {&__pyx_n_s_DvBar_DpsiC, __pyx_k_DvBar_DpsiC, sizeof(__pyx_k_DvBar_DpsiC), 0, 0, 1, 1},
21966  {&__pyx_kp_u_Format_string_allocated_too_shor, __pyx_k_Format_string_allocated_too_shor, sizeof(__pyx_k_Format_string_allocated_too_shor), 0, 1, 0, 0},
21967  {&__pyx_kp_u_Format_string_allocated_too_shor_2, __pyx_k_Format_string_allocated_too_shor_2, sizeof(__pyx_k_Format_string_allocated_too_shor_2), 0, 1, 0, 0},
21968  {&__pyx_n_s_I, __pyx_k_I, sizeof(__pyx_k_I), 0, 0, 1, 1},
21969  {&__pyx_n_s_J, __pyx_k_J, sizeof(__pyx_k_J), 0, 0, 1, 1},
21970  {&__pyx_n_s_KWr, __pyx_k_KWr, sizeof(__pyx_k_KWr), 0, 0, 1, 1},
21971  {&__pyx_n_s_KWs, __pyx_k_KWs, sizeof(__pyx_k_KWs), 0, 0, 1, 1},
21972  {&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor, sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0},
21973  {&__pyx_n_s_RE_NCP1_evaluateElementCoefficie, __pyx_k_RE_NCP1_evaluateElementCoefficie, sizeof(__pyx_k_RE_NCP1_evaluateElementCoefficie), 0, 0, 1, 1},
21974  {&__pyx_n_s_RE_NCP1_evaluateElementCoefficie_2, __pyx_k_RE_NCP1_evaluateElementCoefficie_2, sizeof(__pyx_k_RE_NCP1_evaluateElementCoefficie_2), 0, 0, 1, 1},
21975  {&__pyx_n_s_RE_NCP1_getElementJacobian, __pyx_k_RE_NCP1_getElementJacobian, sizeof(__pyx_k_RE_NCP1_getElementJacobian), 0, 0, 1, 1},
21976  {&__pyx_n_s_RE_NCP1_getElementResidual, __pyx_k_RE_NCP1_getElementResidual, sizeof(__pyx_k_RE_NCP1_getElementResidual), 0, 0, 1, 1},
21977  {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
21978  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
21979  {&__pyx_n_s_a_avg, __pyx_k_a_avg, sizeof(__pyx_k_a_avg), 0, 0, 1, 1},
21980  {&__pyx_n_s_a_eN, __pyx_k_a_eN, sizeof(__pyx_k_a_eN), 0, 0, 1, 1},
21981  {&__pyx_n_s_a_neig, __pyx_k_a_neig, sizeof(__pyx_k_a_neig), 0, 0, 1, 1},
21982  {&__pyx_n_s_a_up, __pyx_k_a_up, sizeof(__pyx_k_a_up), 0, 0, 1, 1},
21983  {&__pyx_n_s_alpha, __pyx_k_alpha, sizeof(__pyx_k_alpha), 0, 0, 1, 1},
21984  {&__pyx_n_s_beta, __pyx_k_beta, sizeof(__pyx_k_beta), 0, 0, 1, 1},
21985  {&__pyx_n_s_calculateNormalFlux, __pyx_k_calculateNormalFlux, sizeof(__pyx_k_calculateNormalFlux), 0, 0, 1, 1},
21986  {&__pyx_n_s_characteristic_velocity, __pyx_k_characteristic_velocity, sizeof(__pyx_k_characteristic_velocity), 0, 0, 1, 1},
21987  {&__pyx_n_s_characteristic_velocity_dofs, __pyx_k_characteristic_velocity_dofs, sizeof(__pyx_k_characteristic_velocity_dofs), 0, 0, 1, 1},
21988  {&__pyx_n_s_clock, __pyx_k_clock, sizeof(__pyx_k_clock), 0, 0, 1, 1},
21989  {&__pyx_n_s_colind, __pyx_k_colind, sizeof(__pyx_k_colind), 0, 0, 1, 1},
21990  {&__pyx_n_s_computeSimpleCharacteristicVeloc, __pyx_k_computeSimpleCharacteristicVeloc, sizeof(__pyx_k_computeSimpleCharacteristicVeloc), 0, 0, 1, 1},
21991  {&__pyx_n_s_computeSimpleCharacteristicVeloc_2, __pyx_k_computeSimpleCharacteristicVeloc_2, sizeof(__pyx_k_computeSimpleCharacteristicVeloc_2), 0, 0, 1, 1},
21992  {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1},
21993  {&__pyx_n_s_dS, __pyx_k_dS, sizeof(__pyx_k_dS), 0, 0, 1, 1},
21994  {&__pyx_n_s_dV, __pyx_k_dV, sizeof(__pyx_k_dV), 0, 0, 1, 1},
21995  {&__pyx_n_s_denom, __pyx_k_denom, sizeof(__pyx_k_denom), 0, 0, 1, 1},
21996  {&__pyx_n_s_df, __pyx_k_df, sizeof(__pyx_k_df), 0, 0, 1, 1},
21997  {&__pyx_n_s_df_dofs, __pyx_k_df_dofs, sizeof(__pyx_k_df_dofs), 0, 0, 1, 1},
21998  {&__pyx_n_s_dkr_up, __pyx_k_dkr_up, sizeof(__pyx_k_dkr_up), 0, 0, 1, 1},
21999  {&__pyx_n_s_dm, __pyx_k_dm, sizeof(__pyx_k_dm), 0, 0, 1, 1},
22000  {&__pyx_n_s_dmt, __pyx_k_dmt, sizeof(__pyx_k_dmt), 0, 0, 1, 1},
22001  {&__pyx_n_s_dmtj_avg, __pyx_k_dmtj_avg, sizeof(__pyx_k_dmtj_avg), 0, 0, 1, 1},
22002  {&__pyx_n_s_dot, __pyx_k_dot, sizeof(__pyx_k_dot), 0, 0, 1, 1},
22003  {&__pyx_n_s_drhom, __pyx_k_drhom, sizeof(__pyx_k_drhom), 0, 0, 1, 1},
22004  {&__pyx_n_s_eN, __pyx_k_eN, sizeof(__pyx_k_eN), 0, 0, 1, 1},
22005  {&__pyx_n_s_eN_left, __pyx_k_eN_left, sizeof(__pyx_k_eN_left), 0, 0, 1, 1},
22006  {&__pyx_n_s_eN_neighbor, __pyx_k_eN_neighbor, sizeof(__pyx_k_eN_neighbor), 0, 0, 1, 1},
22007  {&__pyx_n_s_eN_right, __pyx_k_eN_right, sizeof(__pyx_k_eN_right), 0, 0, 1, 1},
22008  {&__pyx_n_s_ebN, __pyx_k_ebN, sizeof(__pyx_k_ebN), 0, 0, 1, 1},
22009  {&__pyx_n_s_ebNE, __pyx_k_ebNE, sizeof(__pyx_k_ebNE), 0, 0, 1, 1},
22010  {&__pyx_n_s_ebN_local, __pyx_k_ebN_local, sizeof(__pyx_k_ebN_local), 0, 0, 1, 1},
22011  {&__pyx_n_s_ebq_global_vals, __pyx_k_ebq_global_vals, sizeof(__pyx_k_ebq_global_vals), 0, 0, 1, 1},
22012  {&__pyx_n_s_ebq_vals, __pyx_k_ebq_vals, sizeof(__pyx_k_ebq_vals), 0, 0, 1, 1},
22013  {&__pyx_n_s_elementBarycentersArray, __pyx_k_elementBarycentersArray, sizeof(__pyx_k_elementBarycentersArray), 0, 0, 1, 1},
22014  {&__pyx_n_s_elementBoundariesArray, __pyx_k_elementBoundariesArray, sizeof(__pyx_k_elementBoundariesArray), 0, 0, 1, 1},
22015  {&__pyx_n_s_elementBoundaryElementsArray, __pyx_k_elementBoundaryElementsArray, sizeof(__pyx_k_elementBoundaryElementsArray), 0, 0, 1, 1},
22016  {&__pyx_n_s_elementBoundaryMaterialTypes, __pyx_k_elementBoundaryMaterialTypes, sizeof(__pyx_k_elementBoundaryMaterialTypes), 0, 0, 1, 1},
22017  {&__pyx_n_s_elementBoundaryTypes, __pyx_k_elementBoundaryTypes, sizeof(__pyx_k_elementBoundaryTypes), 0, 0, 1, 1},
22018  {&__pyx_n_s_elementJacobian, __pyx_k_elementJacobian, sizeof(__pyx_k_elementJacobian), 0, 0, 1, 1},
22019  {&__pyx_n_s_elementMaterialTypes, __pyx_k_elementMaterialTypes, sizeof(__pyx_k_elementMaterialTypes), 0, 0, 1, 1},
22020  {&__pyx_n_s_elementNeighborsArray, __pyx_k_elementNeighborsArray, sizeof(__pyx_k_elementNeighborsArray), 0, 0, 1, 1},
22021  {&__pyx_n_s_elementResidual, __pyx_k_elementResidual, sizeof(__pyx_k_elementResidual), 0, 0, 1, 1},
22022  {&__pyx_n_s_evaluateScalarMaterialFunctionOv, __pyx_k_evaluateScalarMaterialFunctionOv, sizeof(__pyx_k_evaluateScalarMaterialFunctionOv), 0, 0, 1, 1},
22023  {&__pyx_n_s_evaluateScalarMaterialFunctionOv_2, __pyx_k_evaluateScalarMaterialFunctionOv_2, sizeof(__pyx_k_evaluateScalarMaterialFunctionOv_2), 0, 0, 1, 1},
22024  {&__pyx_n_s_evaluateScalarMaterialFunctionOv_3, __pyx_k_evaluateScalarMaterialFunctionOv_3, sizeof(__pyx_k_evaluateScalarMaterialFunctionOv_3), 0, 0, 1, 1},
22025  {&__pyx_n_s_evaluateSparseTensorMaterialFunc, __pyx_k_evaluateSparseTensorMaterialFunc, sizeof(__pyx_k_evaluateSparseTensorMaterialFunc), 0, 0, 1, 1},
22026  {&__pyx_n_s_evaluateSparseTensorMaterialFunc_2, __pyx_k_evaluateSparseTensorMaterialFunc_2, sizeof(__pyx_k_evaluateSparseTensorMaterialFunc_2), 0, 0, 1, 1},
22027  {&__pyx_n_s_evaluateVectorMaterialFunctionOv, __pyx_k_evaluateVectorMaterialFunctionOv, sizeof(__pyx_k_evaluateVectorMaterialFunctionOv), 0, 0, 1, 1},
22028  {&__pyx_n_s_exteriorElementBoundariesArray, __pyx_k_exteriorElementBoundariesArray, sizeof(__pyx_k_exteriorElementBoundariesArray), 0, 0, 1, 1},
22029  {&__pyx_n_s_exteriorElementBoundaryMaterialT, __pyx_k_exteriorElementBoundaryMaterialT, sizeof(__pyx_k_exteriorElementBoundaryMaterialT), 0, 0, 1, 1},
22030  {&__pyx_n_s_f_up, __pyx_k_f_up, sizeof(__pyx_k_f_up), 0, 0, 1, 1},
22031  {&__pyx_n_s_flat, __pyx_k_flat, sizeof(__pyx_k_flat), 0, 0, 1, 1},
22032  {&__pyx_n_s_flux, __pyx_k_flux, sizeof(__pyx_k_flux), 0, 0, 1, 1},
22033  {&__pyx_n_s_gravity, __pyx_k_gravity, sizeof(__pyx_k_gravity), 0, 0, 1, 1},
22034  {&__pyx_n_s_helicalElementVelocityEval3, __pyx_k_helicalElementVelocityEval3, sizeof(__pyx_k_helicalElementVelocityEval3), 0, 0, 1, 1},
22035  {&__pyx_n_s_helicalElementVelocityEval4, __pyx_k_helicalElementVelocityEval4, sizeof(__pyx_k_helicalElementVelocityEval4), 0, 0, 1, 1},
22036  {&__pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_k_home_cekees_proteus_proteus_sub, sizeof(__pyx_k_home_cekees_proteus_proteus_sub), 0, 0, 1, 0},
22037  {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
22038  {&__pyx_n_s_ii, __pyx_k_ii, sizeof(__pyx_k_ii), 0, 0, 1, 1},
22039  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
22040  {&__pyx_n_s_integral, __pyx_k_integral, sizeof(__pyx_k_integral), 0, 0, 1, 1},
22041  {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1},
22042  {&__pyx_n_s_jacobian_weak_residual, __pyx_k_jacobian_weak_residual, sizeof(__pyx_k_jacobian_weak_residual), 0, 0, 1, 1},
22043  {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
22044  {&__pyx_n_s_kb, __pyx_k_kb, sizeof(__pyx_k_kb), 0, 0, 1, 1},
22045  {&__pyx_n_s_kr_eN, __pyx_k_kr_eN, sizeof(__pyx_k_kr_eN), 0, 0, 1, 1},
22046  {&__pyx_n_s_kr_neig, __pyx_k_kr_neig, sizeof(__pyx_k_kr_neig), 0, 0, 1, 1},
22047  {&__pyx_n_s_l2g, __pyx_k_l2g, sizeof(__pyx_k_l2g), 0, 0, 1, 1},
22048  {&__pyx_n_s_m, __pyx_k_m, sizeof(__pyx_k_m), 0, 0, 1, 1},
22049  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
22050  {&__pyx_n_s_matID, __pyx_k_matID, sizeof(__pyx_k_matID), 0, 0, 1, 1},
22051  {&__pyx_n_s_matID_neig, __pyx_k_matID_neig, sizeof(__pyx_k_matID_neig), 0, 0, 1, 1},
22052  {&__pyx_n_s_material, __pyx_k_material, sizeof(__pyx_k_material), 0, 0, 1, 1},
22053  {&__pyx_n_s_material_functions, __pyx_k_material_functions, sizeof(__pyx_k_material_functions), 0, 0, 1, 1},
22054  {&__pyx_n_s_material_left, __pyx_k_material_left, sizeof(__pyx_k_material_left), 0, 0, 1, 1},
22055  {&__pyx_n_s_material_right, __pyx_k_material_right, sizeof(__pyx_k_material_right), 0, 0, 1, 1},
22056  {&__pyx_n_s_mt, __pyx_k_mt, sizeof(__pyx_k_mt), 0, 0, 1, 1},
22057  {&__pyx_n_s_mt_avg, __pyx_k_mt_avg, sizeof(__pyx_k_mt_avg), 0, 0, 1, 1},
22058  {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
22059  {&__pyx_n_s_nAvgWeight, __pyx_k_nAvgWeight, sizeof(__pyx_k_nAvgWeight), 0, 0, 1, 1},
22060  {&__pyx_n_s_nDOF_test_element, __pyx_k_nDOF_test_element, sizeof(__pyx_k_nDOF_test_element), 0, 0, 1, 1},
22061  {&__pyx_n_s_nDOF_trial_element, __pyx_k_nDOF_trial_element, sizeof(__pyx_k_nDOF_trial_element), 0, 0, 1, 1},
22062  {&__pyx_n_s_nElementBoundaries_element, __pyx_k_nElementBoundaries_element, sizeof(__pyx_k_nElementBoundaries_element), 0, 0, 1, 1},
22063  {&__pyx_n_s_nElementBoundaries_global, __pyx_k_nElementBoundaries_global, sizeof(__pyx_k_nElementBoundaries_global), 0, 0, 1, 1},
22064  {&__pyx_n_s_nElements_global, __pyx_k_nElements_global, sizeof(__pyx_k_nElements_global), 0, 0, 1, 1},
22065  {&__pyx_n_s_nExteriorElementBoundaries_globa, __pyx_k_nExteriorElementBoundaries_globa, sizeof(__pyx_k_nExteriorElementBoundaries_globa), 0, 0, 1, 1},
22066  {&__pyx_n_s_nSpace, __pyx_k_nSpace, sizeof(__pyx_k_nSpace), 0, 0, 1, 1},
22067  {&__pyx_n_s_nSpace2, __pyx_k_nSpace2, sizeof(__pyx_k_nSpace2), 0, 0, 1, 1},
22068  {&__pyx_n_s_nd, __pyx_k_nd, sizeof(__pyx_k_nd), 0, 0, 1, 1},
22069  {&__pyx_kp_u_ndarray_is_not_C_contiguous, __pyx_k_ndarray_is_not_C_contiguous, sizeof(__pyx_k_ndarray_is_not_C_contiguous), 0, 1, 0, 0},
22070  {&__pyx_kp_u_ndarray_is_not_Fortran_contiguou, __pyx_k_ndarray_is_not_Fortran_contiguou, sizeof(__pyx_k_ndarray_is_not_Fortran_contiguou), 0, 1, 0, 0},
22071  {&__pyx_n_s_nnz, __pyx_k_nnz, sizeof(__pyx_k_nnz), 0, 0, 1, 1},
22072  {&__pyx_n_s_numer, __pyx_k_numer, sizeof(__pyx_k_numer), 0, 0, 1, 1},
22073  {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
22074  {&__pyx_n_s_omega_e, __pyx_k_omega_e, sizeof(__pyx_k_omega_e), 0, 0, 1, 1},
22075  {&__pyx_n_s_one8, __pyx_k_one8, sizeof(__pyx_k_one8), 0, 0, 1, 1},
22076  {&__pyx_n_s_onePlus_pcBar_n, __pyx_k_onePlus_pcBar_n, sizeof(__pyx_k_onePlus_pcBar_n), 0, 0, 1, 1},
22077  {&__pyx_n_s_pcBar, __pyx_k_pcBar, sizeof(__pyx_k_pcBar), 0, 0, 1, 1},
22078  {&__pyx_n_s_pcBar_n, __pyx_k_pcBar_n, sizeof(__pyx_k_pcBar_n), 0, 0, 1, 1},
22079  {&__pyx_n_s_pcBar_nM1, __pyx_k_pcBar_nM1, sizeof(__pyx_k_pcBar_nM1), 0, 0, 1, 1},
22080  {&__pyx_n_s_pcBar_nM2, __pyx_k_pcBar_nM2, sizeof(__pyx_k_pcBar_nM2), 0, 0, 1, 1},
22081  {&__pyx_n_s_phi_eN, __pyx_k_phi_eN, sizeof(__pyx_k_phi_eN), 0, 0, 1, 1},
22082  {&__pyx_n_s_phi_neig, __pyx_k_phi_neig, sizeof(__pyx_k_phi_neig), 0, 0, 1, 1},
22083  {&__pyx_n_s_pi, __pyx_k_pi, sizeof(__pyx_k_pi), 0, 0, 1, 1},
22084  {&__pyx_n_s_picard, __pyx_k_picard, sizeof(__pyx_k_picard), 0, 0, 1, 1},
22085  {&__pyx_n_s_psiC, __pyx_k_psiC, sizeof(__pyx_k_psiC), 0, 0, 1, 1},
22086  {&__pyx_n_s_q, __pyx_k_q, sizeof(__pyx_k_q), 0, 0, 1, 1},
22087  {&__pyx_n_s_q_alin, __pyx_k_q_alin, sizeof(__pyx_k_q_alin), 0, 0, 1, 1},
22088  {&__pyx_n_s_q_detJ, __pyx_k_q_detJ, sizeof(__pyx_k_q_detJ), 0, 0, 1, 1},
22089  {&__pyx_n_s_q_dkr, __pyx_k_q_dkr, sizeof(__pyx_k_q_dkr), 0, 0, 1, 1},
22090  {&__pyx_n_s_q_dm, __pyx_k_q_dm, sizeof(__pyx_k_q_dm), 0, 0, 1, 1},
22091  {&__pyx_n_s_q_dmass, __pyx_k_q_dmass, sizeof(__pyx_k_q_dmass), 0, 0, 1, 1},
22092  {&__pyx_n_s_q_dmt, __pyx_k_q_dmt, sizeof(__pyx_k_q_dmt), 0, 0, 1, 1},
22093  {&__pyx_n_s_q_flin, __pyx_k_q_flin, sizeof(__pyx_k_q_flin), 0, 0, 1, 1},
22094  {&__pyx_n_s_q_grad_u, __pyx_k_q_grad_u, sizeof(__pyx_k_q_grad_u), 0, 0, 1, 1},
22095  {&__pyx_n_s_q_grad_v, __pyx_k_q_grad_v, sizeof(__pyx_k_q_grad_v), 0, 0, 1, 1},
22096  {&__pyx_n_s_q_grad_w, __pyx_k_q_grad_w, sizeof(__pyx_k_q_grad_w), 0, 0, 1, 1},
22097  {&__pyx_n_s_q_kr, __pyx_k_q_kr, sizeof(__pyx_k_q_kr), 0, 0, 1, 1},
22098  {&__pyx_n_s_q_kr_up, __pyx_k_q_kr_up, sizeof(__pyx_k_q_kr_up), 0, 0, 1, 1},
22099  {&__pyx_n_s_q_m, __pyx_k_q_m, sizeof(__pyx_k_q_m), 0, 0, 1, 1},
22100  {&__pyx_n_s_q_mass, __pyx_k_q_mass, sizeof(__pyx_k_q_mass), 0, 0, 1, 1},
22101  {&__pyx_n_s_q_mt, __pyx_k_q_mt, sizeof(__pyx_k_q_mt), 0, 0, 1, 1},
22102  {&__pyx_n_s_q_r, __pyx_k_q_r, sizeof(__pyx_k_q_r), 0, 0, 1, 1},
22103  {&__pyx_n_s_q_u, __pyx_k_q_u, sizeof(__pyx_k_q_u), 0, 0, 1, 1},
22104  {&__pyx_n_s_q_vals, __pyx_k_q_vals, sizeof(__pyx_k_q_vals), 0, 0, 1, 1},
22105  {&__pyx_n_s_q_x, __pyx_k_q_x, sizeof(__pyx_k_q_x), 0, 0, 1, 1},
22106  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
22107  {&__pyx_n_s_rho, __pyx_k_rho, sizeof(__pyx_k_rho), 0, 0, 1, 1},
22108  {&__pyx_n_s_rho2, __pyx_k_rho2, sizeof(__pyx_k_rho2), 0, 0, 1, 1},
22109  {&__pyx_n_s_rhom, __pyx_k_rhom, sizeof(__pyx_k_rhom), 0, 0, 1, 1},
22110  {&__pyx_n_s_rotatingGaussianElementVelocityE, __pyx_k_rotatingGaussianElementVelocityE, sizeof(__pyx_k_rotatingGaussianElementVelocityE), 0, 0, 1, 1},
22111  {&__pyx_n_s_rotatingGaussianElementVelocityE_2, __pyx_k_rotatingGaussianElementVelocityE_2, sizeof(__pyx_k_rotatingGaussianElementVelocityE_2), 0, 0, 1, 1},
22112  {&__pyx_n_s_rowptr, __pyx_k_rowptr, sizeof(__pyx_k_rowptr), 0, 0, 1, 1},
22113  {&__pyx_n_s_sBar, __pyx_k_sBar, sizeof(__pyx_k_sBar), 0, 0, 1, 1},
22114  {&__pyx_n_s_setElementBoundariesArray, __pyx_k_setElementBoundariesArray, sizeof(__pyx_k_setElementBoundariesArray), 0, 0, 1, 1},
22115  {&__pyx_n_s_setExteriorElementBoundaryTypes, __pyx_k_setExteriorElementBoundaryTypes, sizeof(__pyx_k_setExteriorElementBoundaryTypes), 0, 0, 1, 1},
22116  {&__pyx_n_s_setScalarMaterialFunctionOverEle, __pyx_k_setScalarMaterialFunctionOverEle, sizeof(__pyx_k_setScalarMaterialFunctionOverEle), 0, 0, 1, 1},
22117  {&__pyx_n_s_setScalarMaterialFunctionOverEle_2, __pyx_k_setScalarMaterialFunctionOverEle_2, sizeof(__pyx_k_setScalarMaterialFunctionOverEle_2), 0, 0, 1, 1},
22118  {&__pyx_n_s_setScalarMaterialFunctionOverGlo, __pyx_k_setScalarMaterialFunctionOverGlo, sizeof(__pyx_k_setScalarMaterialFunctionOverGlo), 0, 0, 1, 1},
22119  {&__pyx_n_s_setSparseTensorMaterialFunctionO, __pyx_k_setSparseTensorMaterialFunctionO, sizeof(__pyx_k_setSparseTensorMaterialFunctionO), 0, 0, 1, 1},
22120  {&__pyx_n_s_setSparseTensorMaterialFunctionO_2, __pyx_k_setSparseTensorMaterialFunctionO_2, sizeof(__pyx_k_setSparseTensorMaterialFunctionO_2), 0, 0, 1, 1},
22121  {&__pyx_n_s_setVectorMaterialFunctionOverEle, __pyx_k_setVectorMaterialFunctionOverEle, sizeof(__pyx_k_setVectorMaterialFunctionOverEle), 0, 0, 1, 1},
22122  {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
22123  {&__pyx_n_s_sqrt_sBar, __pyx_k_sqrt_sBar, sizeof(__pyx_k_sqrt_sBar), 0, 0, 1, 1},
22124  {&__pyx_n_s_subsurfaceTransportFunctions, __pyx_k_subsurfaceTransportFunctions, sizeof(__pyx_k_subsurfaceTransportFunctions), 0, 0, 1, 1},
22125  {&__pyx_n_s_sum, __pyx_k_sum, sizeof(__pyx_k_sum), 0, 0, 1, 1},
22126  {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1},
22127  {&__pyx_n_s_tForReversal, __pyx_k_tForReversal, sizeof(__pyx_k_tForReversal), 0, 0, 1, 1},
22128  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
22129  {&__pyx_n_s_thetaR, __pyx_k_thetaR, sizeof(__pyx_k_thetaR), 0, 0, 1, 1},
22130  {&__pyx_n_s_thetaS, __pyx_k_thetaS, sizeof(__pyx_k_thetaS), 0, 0, 1, 1},
22131  {&__pyx_n_s_thetaSR, __pyx_k_thetaSR, sizeof(__pyx_k_thetaSR), 0, 0, 1, 1},
22132  {&__pyx_n_s_thetaW, __pyx_k_thetaW, sizeof(__pyx_k_thetaW), 0, 0, 1, 1},
22133  {&__pyx_n_s_thisElementIsUpwind, __pyx_k_thisElementIsUpwind, sizeof(__pyx_k_thisElementIsUpwind), 0, 0, 1, 1},
22134  {&__pyx_n_s_transient, __pyx_k_transient, sizeof(__pyx_k_transient), 0, 0, 1, 1},
22135  {&__pyx_n_s_u_dof, __pyx_k_u_dof, sizeof(__pyx_k_u_dof), 0, 0, 1, 1},
22136  {&__pyx_n_s_u_eN, __pyx_k_u_eN, sizeof(__pyx_k_u_eN), 0, 0, 1, 1},
22137  {&__pyx_n_s_u_j, __pyx_k_u_j, sizeof(__pyx_k_u_j), 0, 0, 1, 1},
22138  {&__pyx_n_s_u_l2g, __pyx_k_u_l2g, sizeof(__pyx_k_u_l2g), 0, 0, 1, 1},
22139  {&__pyx_n_s_u_neig, __pyx_k_u_neig, sizeof(__pyx_k_u_neig), 0, 0, 1, 1},
22140  {&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0},
22141  {&__pyx_n_s_updateMassJacobian_weakAvg, __pyx_k_updateMassJacobian_weakAvg, sizeof(__pyx_k_updateMassJacobian_weakAvg), 0, 0, 1, 1},
22142  {&__pyx_n_s_updateMass_weakAvg, __pyx_k_updateMass_weakAvg, sizeof(__pyx_k_updateMass_weakAvg), 0, 0, 1, 1},
22143  {&__pyx_n_s_upwindFlag, __pyx_k_upwindFlag, sizeof(__pyx_k_upwindFlag), 0, 0, 1, 1},
22144  {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
22145  {&__pyx_n_s_vBar, __pyx_k_vBar, sizeof(__pyx_k_vBar), 0, 0, 1, 1},
22146  {&__pyx_n_s_vBar2, __pyx_k_vBar2, sizeof(__pyx_k_vBar2), 0, 0, 1, 1},
22147  {&__pyx_n_s_vol, __pyx_k_vol, sizeof(__pyx_k_vol), 0, 0, 1, 1},
22148  {&__pyx_n_s_volFactor, __pyx_k_volFactor, sizeof(__pyx_k_volFactor), 0, 0, 1, 1},
22149  {&__pyx_n_s_vol_e, __pyx_k_vol_e, sizeof(__pyx_k_vol_e), 0, 0, 1, 1},
22150  {&__pyx_n_s_volume, __pyx_k_volume, sizeof(__pyx_k_volume), 0, 0, 1, 1},
22151  {&__pyx_n_s_vortexElementVelocityEval3, __pyx_k_vortexElementVelocityEval3, sizeof(__pyx_k_vortexElementVelocityEval3), 0, 0, 1, 1},
22152  {&__pyx_n_s_vortexElementVelocityEval4, __pyx_k_vortexElementVelocityEval4, sizeof(__pyx_k_vortexElementVelocityEval4), 0, 0, 1, 1},
22153  {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1},
22154  {&__pyx_n_s_weak_residual, __pyx_k_weak_residual, sizeof(__pyx_k_weak_residual), 0, 0, 1, 1},
22155  {&__pyx_n_s_weight, __pyx_k_weight, sizeof(__pyx_k_weight), 0, 0, 1, 1},
22156  {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
22157  {&__pyx_n_s_xc, __pyx_k_xc, sizeof(__pyx_k_xc), 0, 0, 1, 1},
22158  {&__pyx_n_s_yc, __pyx_k_yc, sizeof(__pyx_k_yc), 0, 0, 1, 1},
22159  {&__pyx_n_s_zVelocity, __pyx_k_zVelocity, sizeof(__pyx_k_zVelocity), 0, 0, 1, 1},
22160  {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
22161  {&__pyx_n_s_zvelocity, __pyx_k_zvelocity, sizeof(__pyx_k_zvelocity), 0, 0, 1, 1},
22162  {0, 0, 0, 0, 0, 0, 0}
22163 };
22164 static int __Pyx_InitCachedBuiltins(void) {
22165  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22166  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22167  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22168  return 0;
22169  __pyx_L1_error:;
22170  return -1;
22171 }
22172 
22173 static int __Pyx_InitCachedConstants(void) {
22174  __Pyx_RefNannyDeclarations
22175  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
22176 
22177  /* "subsurfaceTransportFunctions.pyx":66
22178  * material = elementMaterialTypes[eN]
22179  * for k in range(q_vals.shape[1]):
22180  * q_vals[eN,k,:] = material_functions[material].flat # <<<<<<<<<<<<<<
22181  *
22182  *
22183  */
22184  __pyx_slice_ = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22185  __Pyx_GOTREF(__pyx_slice_);
22186  __Pyx_GIVEREF(__pyx_slice_);
22187 
22188  /* "subsurfaceTransportFunctions.pyx":192
22189  * material = elementMaterialTypes[eN]
22190  * for k in range(x.shape[1]):
22191  * q_vals[eN,k,:] = material_functions[material](x[eN,k],t).flat # <<<<<<<<<<<<<<
22192  *
22193  *
22194  */
22195  __pyx_slice__2 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22196  __Pyx_GOTREF(__pyx_slice__2);
22197  __Pyx_GIVEREF(__pyx_slice__2);
22198 
22199  /* "subsurfaceTransportFunctions.pyx":794
22200  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
22201  * v[eN,k,2]=zvelocity
22202  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
22203  * else:
22204  * for eN in range(x.shape[0]):
22205  */
22206  __pyx_slice__3 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22207  __Pyx_GOTREF(__pyx_slice__3);
22208  __Pyx_GIVEREF(__pyx_slice__3);
22209 
22210  /* "subsurfaceTransportFunctions.pyx":808
22211  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
22212  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
22213  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
22214  * else:
22215  * for eN in range(x.shape[0]):
22216  */
22217  __pyx_slice__4 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22218  __Pyx_GOTREF(__pyx_slice__4);
22219  __Pyx_GIVEREF(__pyx_slice__4);
22220 
22221  /* "subsurfaceTransportFunctions.pyx":835
22222  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
22223  * v[eN,ebN,k,2]=zvelocity
22224  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
22225  * else:
22226  * for eN in range(x.shape[0]):
22227  */
22228  __pyx_slice__5 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22229  __Pyx_GOTREF(__pyx_slice__5);
22230  __Pyx_GIVEREF(__pyx_slice__5);
22231 
22232  /* "subsurfaceTransportFunctions.pyx":851
22233  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
22234  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
22235  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
22236  * else:
22237  * for eN in range(x.shape[0]):
22238  */
22239  __pyx_slice__6 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22240  __Pyx_GOTREF(__pyx_slice__6);
22241  __Pyx_GIVEREF(__pyx_slice__6);
22242 
22243  /* "subsurfaceTransportFunctions.pyx":876
22244  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
22245  * v[eN,k,2]=zVelocity
22246  * v[eN,k,:]*=clock*cos(pi*t/(tForReversal*2.0)) # <<<<<<<<<<<<<<
22247  * else:
22248  * for eN in range(x.shape[0]):
22249  */
22250  __pyx_slice__7 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22251  __Pyx_GOTREF(__pyx_slice__7);
22252  __Pyx_GIVEREF(__pyx_slice__7);
22253 
22254  /* "subsurfaceTransportFunctions.pyx":902
22255  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
22256  * v[eN,ebN,k,2]=zVelocity
22257  * v[eN,ebN,k,:]*=clock*cos(pi*t/(tForReversal*2.0)) # <<<<<<<<<<<<<<
22258  * else:
22259  * for eN in range(x.shape[0]):
22260  */
22261  __pyx_slice__8 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22262  __Pyx_GOTREF(__pyx_slice__8);
22263  __Pyx_GIVEREF(__pyx_slice__8);
22264 
22265  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":218
22266  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
22267  * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
22268  * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
22269  *
22270  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
22271  */
22272  __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22273  __Pyx_GOTREF(__pyx_tuple__9);
22274  __Pyx_GIVEREF(__pyx_tuple__9);
22275 
22276  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":222
22277  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
22278  * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
22279  * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
22280  *
22281  * info.buf = PyArray_DATA(self)
22282  */
22283  __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22284  __Pyx_GOTREF(__pyx_tuple__10);
22285  __Pyx_GIVEREF(__pyx_tuple__10);
22286 
22287  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":259
22288  * if ((descr.byteorder == c'>' and little_endian) or
22289  * (descr.byteorder == c'<' and not little_endian)):
22290  * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
22291  * if t == NPY_BYTE: f = "b"
22292  * elif t == NPY_UBYTE: f = "B"
22293  */
22294  __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22295  __Pyx_GOTREF(__pyx_tuple__11);
22296  __Pyx_GIVEREF(__pyx_tuple__11);
22297 
22298  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":799
22299  *
22300  * if (end - f) - <int>(new_offset - offset[0]) < 15:
22301  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
22302  *
22303  * if ((child.byteorder == c'>' and little_endian) or
22304  */
22305  __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22306  __Pyx_GOTREF(__pyx_tuple__12);
22307  __Pyx_GIVEREF(__pyx_tuple__12);
22308 
22309  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":803
22310  * if ((child.byteorder == c'>' and little_endian) or
22311  * (child.byteorder == c'<' and not little_endian)):
22312  * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
22313  * # One could encode it in the format string and have Cython
22314  * # complain instead, BUT: < and > in format strings also imply
22315  */
22316  __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22317  __Pyx_GOTREF(__pyx_tuple__13);
22318  __Pyx_GIVEREF(__pyx_tuple__13);
22319 
22320  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":823
22321  * t = child.type_num
22322  * if end - f < 5:
22323  * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
22324  *
22325  * # Until ticket #99 is fixed, use integers to avoid warnings
22326  */
22327  __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22328  __Pyx_GOTREF(__pyx_tuple__14);
22329  __Pyx_GIVEREF(__pyx_tuple__14);
22330 
22331  /* "subsurfaceTransportFunctions.pyx":18
22332  * ctypedef int ITYPE_t
22333  *
22334  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global, # <<<<<<<<<<<<<<
22335  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundariesArray,
22336  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
22337  */
22338  __pyx_tuple__15 = PyTuple_Pack(8, __pyx_n_s_nExteriorElementBoundaries_globa, __pyx_n_s_exteriorElementBoundariesArray, __pyx_n_s_elementBoundaryElementsArray, __pyx_n_s_elementMaterialTypes, __pyx_n_s_exteriorElementBoundaryMaterialT, __pyx_n_s_ebNE, __pyx_n_s_ebN, __pyx_n_s_eN); if (unlikely(!__pyx_tuple__15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22339  __Pyx_GOTREF(__pyx_tuple__15);
22340  __Pyx_GIVEREF(__pyx_tuple__15);
22341  __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(5, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_setExteriorElementBoundaryTypes, 18, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22342 
22343  /* "subsurfaceTransportFunctions.pyx":29
22344  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
22345  *
22346  * def setElementBoundariesArray(int nElementBoundaries_global, # <<<<<<<<<<<<<<
22347  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
22348  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
22349  */
22350  __pyx_tuple__17 = PyTuple_Pack(7, __pyx_n_s_nElementBoundaries_global, __pyx_n_s_elementBoundaryElementsArray, __pyx_n_s_elementMaterialTypes, __pyx_n_s_elementBoundaryMaterialTypes, __pyx_n_s_ebN, __pyx_n_s_eN_left, __pyx_n_s_eN_right); if (unlikely(!__pyx_tuple__17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22351  __Pyx_GOTREF(__pyx_tuple__17);
22352  __Pyx_GIVEREF(__pyx_tuple__17);
22353  __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(4, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_setElementBoundariesArray, 29, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22354 
22355  /* "subsurfaceTransportFunctions.pyx":43
22356  *
22357  * ###
22358  * def setScalarMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
22359  * numpy.ndarray[DTYPE_t,ndim=2] q_vals,
22360  * dict material_functions):
22361  */
22362  __pyx_tuple__19 = PyTuple_Pack(6, __pyx_n_s_elementMaterialTypes, __pyx_n_s_q_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_material); if (unlikely(!__pyx_tuple__19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22363  __Pyx_GOTREF(__pyx_tuple__19);
22364  __Pyx_GIVEREF(__pyx_tuple__19);
22365  __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_setScalarMaterialFunctionOverEle, 43, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22366 
22367  /* "subsurfaceTransportFunctions.pyx":56
22368  * q_vals[eN,k] = material_functions[material]
22369  *
22370  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
22371  * numpy.ndarray[DTYPE_t,ndim=3] q_vals,
22372  * dict material_functions):
22373  */
22374  __pyx_tuple__21 = PyTuple_Pack(6, __pyx_n_s_elementMaterialTypes, __pyx_n_s_q_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_material); if (unlikely(!__pyx_tuple__21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22375  __Pyx_GOTREF(__pyx_tuple__21);
22376  __Pyx_GIVEREF(__pyx_tuple__21);
22377  __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_setVectorMaterialFunctionOverEle, 56, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22378 
22379  /* "subsurfaceTransportFunctions.pyx":69
22380  *
22381  *
22382  * def setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
22383  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
22384  * numpy.ndarray[DTYPE_t,ndim=3] ebq_vals,
22385  */
22386  __pyx_tuple__23 = PyTuple_Pack(10, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_ebq_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_ebN_local, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right); if (unlikely(!__pyx_tuple__23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22387  __Pyx_GOTREF(__pyx_tuple__23);
22388  __Pyx_GIVEREF(__pyx_tuple__23);
22389  __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(4, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_setScalarMaterialFunctionOverEle_2, 69, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22390 
22391  /* "subsurfaceTransportFunctions.pyx":91
22392  * material_functions[material_right])
22393  *
22394  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
22395  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
22396  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
22397  */
22398  __pyx_tuple__25 = PyTuple_Pack(15, __pyx_n_s_nd, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_ebq_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_ebN_local, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_I, __pyx_n_s_J, __pyx_n_s_numer, __pyx_n_s_denom); if (unlikely(!__pyx_tuple__25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22399  __Pyx_GOTREF(__pyx_tuple__25);
22400  __Pyx_GIVEREF(__pyx_tuple__25);
22401  __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(5, 0, 15, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_setSparseTensorMaterialFunctionO, 91, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22402 
22403  /* "subsurfaceTransportFunctions.pyx":118
22404  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
22405  *
22406  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
22407  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
22408  * numpy.ndarray[DTYPE_t,ndim=2] ebq_global_vals,
22409  */
22410  __pyx_tuple__27 = PyTuple_Pack(8, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_ebq_global_vals, __pyx_n_s_material_functions, __pyx_n_s_ebN, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_k); if (unlikely(!__pyx_tuple__27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22411  __Pyx_GOTREF(__pyx_tuple__27);
22412  __Pyx_GIVEREF(__pyx_tuple__27);
22413  __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(4, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_setScalarMaterialFunctionOverGlo, 118, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22414 
22415  /* "subsurfaceTransportFunctions.pyx":139
22416  *
22417  *
22418  * def setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
22419  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
22420  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
22421  */
22422  __pyx_tuple__29 = PyTuple_Pack(13, __pyx_n_s_nd, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_ebq_global_vals, __pyx_n_s_material_functions, __pyx_n_s_ebN, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_I, __pyx_n_s_J, __pyx_n_s_numer, __pyx_n_s_denom); if (unlikely(!__pyx_tuple__29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22423  __Pyx_GOTREF(__pyx_tuple__29);
22424  __Pyx_GIVEREF(__pyx_tuple__29);
22425  __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(5, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_setSparseTensorMaterialFunctionO_2, 139, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22426 
22427  /* "subsurfaceTransportFunctions.pyx":165
22428  *
22429  * ###
22430  * def evaluateScalarMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
22431  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
22432  * numpy.ndarray[DTYPE_t,ndim=3] x,
22433  */
22434  __pyx_tuple__31 = PyTuple_Pack(8, __pyx_n_s_t, __pyx_n_s_elementMaterialTypes, __pyx_n_s_x, __pyx_n_s_q_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_material); if (unlikely(!__pyx_tuple__31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22435  __Pyx_GOTREF(__pyx_tuple__31);
22436  __Pyx_GIVEREF(__pyx_tuple__31);
22437  __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(5, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_evaluateScalarMaterialFunctionOv, 165, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22438 
22439  /* "subsurfaceTransportFunctions.pyx":180
22440  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
22441  *
22442  * def evaluateVectorMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
22443  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
22444  * numpy.ndarray[DTYPE_t,ndim=3] x,
22445  */
22446  __pyx_tuple__33 = PyTuple_Pack(8, __pyx_n_s_t, __pyx_n_s_elementMaterialTypes, __pyx_n_s_x, __pyx_n_s_q_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_material); if (unlikely(!__pyx_tuple__33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22447  __Pyx_GOTREF(__pyx_tuple__33);
22448  __Pyx_GIVEREF(__pyx_tuple__33);
22449  __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(5, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_evaluateVectorMaterialFunctionOv, 180, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22450 
22451  /* "subsurfaceTransportFunctions.pyx":195
22452  *
22453  *
22454  * def evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
22455  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
22456  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
22457  */
22458  __pyx_tuple__35 = PyTuple_Pack(12, __pyx_n_s_t, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_x, __pyx_n_s_ebq_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_ebN_local, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right); if (unlikely(!__pyx_tuple__35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22459  __Pyx_GOTREF(__pyx_tuple__35);
22460  __Pyx_GIVEREF(__pyx_tuple__35);
22461  __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(6, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_evaluateScalarMaterialFunctionOv_2, 195, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22462 
22463  /* "subsurfaceTransportFunctions.pyx":219
22464  * material_functions[material_right](x[eN,ebN_local,k],t))
22465  *
22466  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
22467  * double t,
22468  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
22469  */
22470  __pyx_tuple__37 = PyTuple_Pack(17, __pyx_n_s_nd, __pyx_n_s_t, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_x, __pyx_n_s_ebq_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_ebN_local, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_I, __pyx_n_s_J, __pyx_n_s_numer, __pyx_n_s_denom); if (unlikely(!__pyx_tuple__37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22471  __Pyx_GOTREF(__pyx_tuple__37);
22472  __Pyx_GIVEREF(__pyx_tuple__37);
22473  __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(7, 0, 17, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_evaluateSparseTensorMaterialFunc, 219, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22474 
22475  /* "subsurfaceTransportFunctions.pyx":248
22476  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
22477  *
22478  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
22479  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
22480  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
22481  */
22482  __pyx_tuple__39 = PyTuple_Pack(10, __pyx_n_s_t, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_x, __pyx_n_s_ebq_global_vals, __pyx_n_s_material_functions, __pyx_n_s_ebN, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_k); if (unlikely(!__pyx_tuple__39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22483  __Pyx_GOTREF(__pyx_tuple__39);
22484  __Pyx_GIVEREF(__pyx_tuple__39);
22485  __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(6, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_evaluateScalarMaterialFunctionOv_3, 248, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22486 
22487  /* "subsurfaceTransportFunctions.pyx":271
22488  *
22489  *
22490  * def evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
22491  * double t,
22492  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
22493  */
22494  __pyx_tuple__41 = PyTuple_Pack(15, __pyx_n_s_nd, __pyx_n_s_t, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_x, __pyx_n_s_ebq_global_vals, __pyx_n_s_material_functions, __pyx_n_s_ebN, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_I, __pyx_n_s_J, __pyx_n_s_numer, __pyx_n_s_denom); if (unlikely(!__pyx_tuple__41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22495  __Pyx_GOTREF(__pyx_tuple__41);
22496  __Pyx_GIVEREF(__pyx_tuple__41);
22497  __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(7, 0, 15, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_evaluateSparseTensorMaterialFunc_2, 271, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22498 
22499  /* "subsurfaceTransportFunctions.pyx":301
22500  *
22501  * ##################################################
22502  * def RE_NCP1_evaluateElementCoefficients_Linear(double rho, # <<<<<<<<<<<<<<
22503  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
22504  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
22505  */
22506  __pyx_tuple__43 = PyTuple_Pack(24, __pyx_n_s_rho, __pyx_n_s_gravity, __pyx_n_s_rowptr, __pyx_n_s_colind, __pyx_n_s_KWs, __pyx_n_s_nSpace, __pyx_n_s_nElements_global, __pyx_n_s_nElementBoundaries_element, __pyx_n_s_elementNeighborsArray, __pyx_n_s_elementMaterialTypes, __pyx_n_s_q_flin, __pyx_n_s_q_alin, __pyx_n_s_eN, __pyx_n_s_eN_neighbor, __pyx_n_s_ii, __pyx_n_s_I, __pyx_n_s_ebN, __pyx_n_s_matID, __pyx_n_s_matID_neig, __pyx_n_s_nSpace2, __pyx_n_s_nnz, __pyx_n_s_a_eN, __pyx_n_s_a_neig, __pyx_n_s_a_avg); if (unlikely(!__pyx_tuple__43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22507  __Pyx_GOTREF(__pyx_tuple__43);
22508  __Pyx_GIVEREF(__pyx_tuple__43);
22509  __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(12, 0, 24, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_RE_NCP1_evaluateElementCoefficie, 301, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22510 
22511  /* "subsurfaceTransportFunctions.pyx":359
22512  *
22513  *
22514  * def RE_NCP1_evaluateElementCoefficients_VGM(double rho, # <<<<<<<<<<<<<<
22515  * double beta,
22516  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
22517  */
22518  __pyx_tuple__45 = PyTuple_Pack(61, __pyx_n_s_rho, __pyx_n_s_beta, __pyx_n_s_gravity, __pyx_n_s_alpha, __pyx_n_s_n, __pyx_n_s_thetaR, __pyx_n_s_thetaSR, __pyx_n_s_nSpace, __pyx_n_s_nElements_global, __pyx_n_s_nElementBoundaries_element, __pyx_n_s_elementNeighborsArray, __pyx_n_s_elementBarycentersArray, __pyx_n_s_elementMaterialTypes, __pyx_n_s_nDOF_trial_element, __pyx_n_s_u_l2g, __pyx_n_s_u_dof, __pyx_n_s_q_x, __pyx_n_s_q_u, __pyx_n_s_q_mass, __pyx_n_s_q_dmass, __pyx_n_s_q_r, __pyx_n_s_q_kr, __pyx_n_s_q_dkr, __pyx_n_s_q_kr_up, __pyx_n_s_q, __pyx_n_s_psiC, __pyx_n_s_pcBar, __pyx_n_s_pcBar_n, __pyx_n_s_pcBar_nM1, __pyx_n_s_pcBar_nM2, __pyx_n_s_onePlus_pcBar_n, __pyx_n_s_sBar, __pyx_n_s_sqrt_sBar, __pyx_n_s_DsBar_DpsiC, __pyx_n_s_thetaW, __pyx_n_s_DthetaW_DpsiC, __pyx_n_s_vBar, __pyx_n_s_vBar2, __pyx_n_s_DvBar_DpsiC, __pyx_n_s_KWr, __pyx_n_s_DKWr_DpsiC, __pyx_n_s_rho2, __pyx_n_s_thetaS, __pyx_n_s_rhom, __pyx_n_s_drhom, __pyx_n_s_m, __pyx_n_s_u_j, __pyx_n_s_u_eN, __pyx_n_s_u_neig, __pyx_n_s_kr_eN, __pyx_n_s_kr_neig, __pyx_n_s_phi_eN, __pyx_n_s_phi_neig, __pyx_n_s_eN, __pyx_n_s_eN_neighbor, __pyx_n_s_ebN, __pyx_n_s_ii, __pyx_n_s_I, __pyx_n_s_j, __pyx_n_s_matID, __pyx_n_s_nAvgWeight); if (unlikely(!__pyx_tuple__45)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22519  __Pyx_GOTREF(__pyx_tuple__45);
22520  __Pyx_GIVEREF(__pyx_tuple__45);
22521  __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(24, 0, 61, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_RE_NCP1_evaluateElementCoefficie_2, 359, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22522 
22523  /* "subsurfaceTransportFunctions.pyx":486
22524  * #eN for upwind
22525  *
22526  * def RE_NCP1_getElementResidual(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
22527  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
22528  * numpy.ndarray[ITYPE_t,ndim=1] colind,
22529  */
22530  __pyx_tuple__47 = PyTuple_Pack(42, __pyx_n_s_gravity, __pyx_n_s_rowptr, __pyx_n_s_colind, __pyx_n_s_nSpace, __pyx_n_s_nElements_global, __pyx_n_s_nElementBoundaries_element, __pyx_n_s_elementNeighborsArray, __pyx_n_s_elementBarycentersArray, __pyx_n_s_nDOF_test_element, __pyx_n_s_q_u, __pyx_n_s_q_grad_u, __pyx_n_s_q_grad_w, __pyx_n_s_q_detJ, __pyx_n_s_q_m, __pyx_n_s_q_mt, __pyx_n_s_q_r, __pyx_n_s_q_kr, __pyx_n_s_q_kr_up, __pyx_n_s_q_flin, __pyx_n_s_q_alin, __pyx_n_s_elementResidual, __pyx_n_s_upwindFlag, __pyx_n_s_q, __pyx_n_s_nnz, __pyx_n_s_u_eN, __pyx_n_s_kr_eN, __pyx_n_s_phi_eN, __pyx_n_s_u_neig, __pyx_n_s_kr_neig, __pyx_n_s_phi_neig, __pyx_n_s_eN, __pyx_n_s_eN_neighbor, __pyx_n_s_ii, __pyx_n_s_I, __pyx_n_s_i, __pyx_n_s_ebN, __pyx_n_s_a_up, __pyx_n_s_f_up, __pyx_n_s_nAvgWeight, __pyx_n_s_weight, __pyx_n_s_volFactor, __pyx_n_s_volume); if (unlikely(!__pyx_tuple__47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22531  __Pyx_GOTREF(__pyx_tuple__47);
22532  __Pyx_GIVEREF(__pyx_tuple__47);
22533  __pyx_codeobj__48 = (PyObject*)__Pyx_PyCode_New(21, 0, 42, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_RE_NCP1_getElementResidual, 486, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22534 
22535  /* "subsurfaceTransportFunctions.pyx":574
22536  * #i
22537  * #eN
22538  * def RE_NCP1_getElementJacobian(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
22539  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
22540  * numpy.ndarray[ITYPE_t,ndim=1] colind,
22541  */
22542  __pyx_tuple__49 = PyTuple_Pack(51, __pyx_n_s_gravity, __pyx_n_s_rowptr, __pyx_n_s_colind, __pyx_n_s_nSpace, __pyx_n_s_nElements_global, __pyx_n_s_nElementBoundaries_element, __pyx_n_s_elementNeighborsArray, __pyx_n_s_elementBarycentersArray, __pyx_n_s_nDOF_test_element, __pyx_n_s_nDOF_trial_element, __pyx_n_s_q_u, __pyx_n_s_q_grad_u, __pyx_n_s_q_grad_w, __pyx_n_s_q_grad_v, __pyx_n_s_q_detJ, __pyx_n_s_q_m, __pyx_n_s_q_dm, __pyx_n_s_q_mt, __pyx_n_s_q_dmt, __pyx_n_s_q_r, __pyx_n_s_q_kr, __pyx_n_s_q_dkr, __pyx_n_s_q_kr_up, __pyx_n_s_q_flin, __pyx_n_s_q_alin, __pyx_n_s_elementJacobian, __pyx_n_s_upwindFlag, __pyx_n_s_picard, __pyx_n_s_q, __pyx_n_s_nnz, __pyx_n_s_u_eN, __pyx_n_s_kr_eN, __pyx_n_s_phi_eN, __pyx_n_s_u_neig, __pyx_n_s_kr_neig, __pyx_n_s_phi_neig, __pyx_n_s_dkr_up, __pyx_n_s_eN, __pyx_n_s_eN_neighbor, __pyx_n_s_ii, __pyx_n_s_I, __pyx_n_s_a_up, __pyx_n_s_f_up, __pyx_n_s_nAvgWeight, __pyx_n_s_weight, __pyx_n_s_volFactor, __pyx_n_s_thisElementIsUpwind, __pyx_n_s_volume, __pyx_n_s_i, __pyx_n_s_ebN, __pyx_n_s_j); if (unlikely(!__pyx_tuple__49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22543  __Pyx_GOTREF(__pyx_tuple__49);
22544  __Pyx_GIVEREF(__pyx_tuple__49);
22545  __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(26, 0, 51, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_RE_NCP1_getElementJacobian, 574, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22546 
22547  /* "subsurfaceTransportFunctions.pyx":673
22548  * ##################################################
22549  *
22550  * def updateMass_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] mt, # <<<<<<<<<<<<<<
22551  * numpy.ndarray[DTYPE_t,ndim=3] w,
22552  * numpy.ndarray[DTYPE_t,ndim=2] dV,
22553  */
22554  __pyx_tuple__51 = PyTuple_Pack(9, __pyx_n_s_mt, __pyx_n_s_w, __pyx_n_s_dV, __pyx_n_s_weak_residual, __pyx_n_s_eN, __pyx_n_s_i, __pyx_n_s_k, __pyx_n_s_mt_avg, __pyx_n_s_vol); if (unlikely(!__pyx_tuple__51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22555  __Pyx_GOTREF(__pyx_tuple__51);
22556  __Pyx_GIVEREF(__pyx_tuple__51);
22557  __pyx_codeobj__52 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__51, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_updateMass_weakAvg, 673, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22558 
22559  /* "subsurfaceTransportFunctions.pyx":692
22560  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
22561  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
22562  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt, # <<<<<<<<<<<<<<
22563  * numpy.ndarray[DTYPE_t,ndim=3] w,
22564  * numpy.ndarray[DTYPE_t,ndim=3] v,
22565  */
22566  __pyx_tuple__53 = PyTuple_Pack(11, __pyx_n_s_dmt, __pyx_n_s_w, __pyx_n_s_v, __pyx_n_s_dV, __pyx_n_s_jacobian_weak_residual, __pyx_n_s_eN, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_dmtj_avg, __pyx_n_s_vol); if (unlikely(!__pyx_tuple__53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22567  __Pyx_GOTREF(__pyx_tuple__53);
22568  __Pyx_GIVEREF(__pyx_tuple__53);
22569  __pyx_codeobj__54 = (PyObject*)__Pyx_PyCode_New(5, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__53, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_updateMassJacobian_weakAvg, 692, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__54)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22570 
22571  /* "subsurfaceTransportFunctions.pyx":717
22572  * #ELLAM
22573  * ########################################################################
22574  * def calculateNormalFlux(numpy.ndarray[DTYPE_t,ndim=4] v, # <<<<<<<<<<<<<<
22575  * numpy.ndarray[DTYPE_t,ndim=4] n,
22576  * numpy.ndarray[DTYPE_t,ndim=3] dS,
22577  */
22578  __pyx_tuple__55 = PyTuple_Pack(9, __pyx_n_s_v, __pyx_n_s_n, __pyx_n_s_dS, __pyx_n_s_flux, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_kb, __pyx_n_s_integral, __pyx_n_s_I); if (unlikely(!__pyx_tuple__55)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22579  __Pyx_GOTREF(__pyx_tuple__55);
22580  __Pyx_GIVEREF(__pyx_tuple__55);
22581  __pyx_codeobj__56 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_calculateNormalFlux, 717, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__56)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22582 
22583  /* "subsurfaceTransportFunctions.pyx":732
22584  * flux[eN,ebN] = integral
22585  *
22586  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df, # <<<<<<<<<<<<<<
22587  * numpy.ndarray[DTYPE_t,ndim=3] characteristic_velocity,
22588  * numpy.ndarray[DTYPE_t,ndim=2] dm,
22589  */
22590  __pyx_tuple__57 = PyTuple_Pack(9, __pyx_n_s_df, __pyx_n_s_characteristic_velocity, __pyx_n_s_dm, __pyx_n_s_dV, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_I, __pyx_n_s_omega_e, __pyx_n_s_vol_e); if (unlikely(!__pyx_tuple__57)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22591  __Pyx_GOTREF(__pyx_tuple__57);
22592  __Pyx_GIVEREF(__pyx_tuple__57);
22593  __pyx_codeobj__58 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_computeSimpleCharacteristicVeloc, 732, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__58)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22594 
22595  /* "subsurfaceTransportFunctions.pyx":753
22596  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
22597  *
22598  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs, # <<<<<<<<<<<<<<
22599  * numpy.ndarray[DTYPE_t,ndim=1] characteristic_velocity_dofs,
22600  * numpy.ndarray[ITYPE_t,ndim=2] l2g,
22601  */
22602  __pyx_tuple__59 = PyTuple_Pack(11, __pyx_n_s_df_dofs, __pyx_n_s_characteristic_velocity_dofs, __pyx_n_s_l2g, __pyx_n_s_dm, __pyx_n_s_dV, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_j, __pyx_n_s_J, __pyx_n_s_omega_e, __pyx_n_s_vol_e); if (unlikely(!__pyx_tuple__59)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22603  __Pyx_GOTREF(__pyx_tuple__59);
22604  __Pyx_GIVEREF(__pyx_tuple__59);
22605  __pyx_codeobj__60 = (PyObject*)__Pyx_PyCode_New(5, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_computeSimpleCharacteristicVeloc_2, 753, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__60)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22606 
22607  /* "subsurfaceTransportFunctions.pyx":776
22608  *
22609  * #problem specific velocity evaluation
22610  * def rotatingGaussianElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
22611  * double t,
22612  * double tForReversal,
22613  */
22614  __pyx_tuple__61 = PyTuple_Pack(12, __pyx_n_s_transient, __pyx_n_s_t, __pyx_n_s_tForReversal, __pyx_n_s_clock, __pyx_n_s_xc, __pyx_n_s_yc, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_zvelocity, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_pi); if (unlikely(!__pyx_tuple__61)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22615  __Pyx_GOTREF(__pyx_tuple__61);
22616  __Pyx_GIVEREF(__pyx_tuple__61);
22617  __pyx_codeobj__62 = (PyObject*)__Pyx_PyCode_New(9, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__61, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_rotatingGaussianElementVelocityE, 776, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__62)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22618 
22619  /* "subsurfaceTransportFunctions.pyx":816
22620  *
22621  *
22622  * def rotatingGaussianElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
22623  * double t,
22624  * double tForReversal,
22625  */
22626  __pyx_tuple__63 = PyTuple_Pack(13, __pyx_n_s_transient, __pyx_n_s_t, __pyx_n_s_tForReversal, __pyx_n_s_clock, __pyx_n_s_xc, __pyx_n_s_yc, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_zvelocity, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_k, __pyx_n_s_pi); if (unlikely(!__pyx_tuple__63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22627  __Pyx_GOTREF(__pyx_tuple__63);
22628  __Pyx_GIVEREF(__pyx_tuple__63);
22629  __pyx_codeobj__64 = (PyObject*)__Pyx_PyCode_New(9, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_rotatingGaussianElementVelocityE_2, 816, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22630 
22631  /* "subsurfaceTransportFunctions.pyx":859
22632  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
22633  *
22634  * def helicalElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
22635  * double t,
22636  * double tForReversal,
22637  */
22638  __pyx_tuple__65 = PyTuple_Pack(12, __pyx_n_s_transient, __pyx_n_s_t, __pyx_n_s_tForReversal, __pyx_n_s_clock, __pyx_n_s_zVelocity, __pyx_n_s_xc, __pyx_n_s_yc, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_pi); if (unlikely(!__pyx_tuple__65)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22639  __Pyx_GOTREF(__pyx_tuple__65);
22640  __Pyx_GIVEREF(__pyx_tuple__65);
22641  __pyx_codeobj__66 = (PyObject*)__Pyx_PyCode_New(9, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__65, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_helicalElementVelocityEval3, 859, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22642 
22643  /* "subsurfaceTransportFunctions.pyx":884
22644  * v[eN,k,2]=zVelocity
22645  *
22646  * def helicalElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
22647  * double t,
22648  * double tForReversal,
22649  */
22650  __pyx_tuple__67 = PyTuple_Pack(13, __pyx_n_s_transient, __pyx_n_s_t, __pyx_n_s_tForReversal, __pyx_n_s_clock, __pyx_n_s_zVelocity, __pyx_n_s_xc, __pyx_n_s_yc, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_k, __pyx_n_s_pi); if (unlikely(!__pyx_tuple__67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22651  __Pyx_GOTREF(__pyx_tuple__67);
22652  __Pyx_GIVEREF(__pyx_tuple__67);
22653  __pyx_codeobj__68 = (PyObject*)__Pyx_PyCode_New(9, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__67, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_helicalElementVelocityEval4, 884, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__68)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22654 
22655  /* "subsurfaceTransportFunctions.pyx":911
22656  * v[eN,ebN,k,2]=zVelocity
22657  *
22658  * def vortexElementVelocityEval3(double t, # <<<<<<<<<<<<<<
22659  * numpy.ndarray[DTYPE_t,ndim=3] x,
22660  * numpy.ndarray[DTYPE_t,ndim=3] v):
22661  */
22662  __pyx_tuple__69 = PyTuple_Pack(7, __pyx_n_s_t, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_pi, __pyx_n_s_one8); if (unlikely(!__pyx_tuple__69)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22663  __Pyx_GOTREF(__pyx_tuple__69);
22664  __Pyx_GIVEREF(__pyx_tuple__69);
22665  __pyx_codeobj__70 = (PyObject*)__Pyx_PyCode_New(3, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__69, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_vortexElementVelocityEval3, 911, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__70)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22666 
22667  /* "subsurfaceTransportFunctions.pyx":924
22668  *
22669  *
22670  * def vortexElementVelocityEval4(double t, # <<<<<<<<<<<<<<
22671  * numpy.ndarray[DTYPE_t,ndim=4] x,
22672  * numpy.ndarray[DTYPE_t,ndim=4] v):
22673  */
22674  __pyx_tuple__71 = PyTuple_Pack(8, __pyx_n_s_t, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_ebN, __pyx_n_s_pi, __pyx_n_s_one8); if (unlikely(!__pyx_tuple__71)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22675  __Pyx_GOTREF(__pyx_tuple__71);
22676  __Pyx_GIVEREF(__pyx_tuple__71);
22677  __pyx_codeobj__72 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_vortexElementVelocityEval4, 924, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__72)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22678  __Pyx_RefNannyFinishContext();
22679  return 0;
22680  __pyx_L1_error:;
22681  __Pyx_RefNannyFinishContext();
22682  return -1;
22683 }
22684 
22685 static int __Pyx_InitGlobals(void) {
22686  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
22687  __pyx_float_0_0 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_float_0_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22688  __pyx_float_0_5 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_float_0_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22689  __pyx_float_2_0 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_float_2_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22690  __pyx_float_1_0eneg_20 = PyFloat_FromDouble(1.0e-20); if (unlikely(!__pyx_float_1_0eneg_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22691  return 0;
22692  __pyx_L1_error:;
22693  return -1;
22694 }
22695 
22696 #if PY_MAJOR_VERSION < 3
22697 PyMODINIT_FUNC initsubsurfaceTransportFunctions(void); /*proto*/
22698 PyMODINIT_FUNC initsubsurfaceTransportFunctions(void)
22699 #else
22700 PyMODINIT_FUNC PyInit_subsurfaceTransportFunctions(void); /*proto*/
22701 PyMODINIT_FUNC PyInit_subsurfaceTransportFunctions(void)
22702 #endif
22703 {
22704  PyObject *__pyx_t_1 = NULL;
22705  int __pyx_lineno = 0;
22706  const char *__pyx_filename = NULL;
22707  int __pyx_clineno = 0;
22708  __Pyx_RefNannyDeclarations
22709  #if CYTHON_REFNANNY
22710  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
22711  if (!__Pyx_RefNanny) {
22712  PyErr_Clear();
22713  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
22714  if (!__Pyx_RefNanny)
22715  Py_FatalError("failed to import 'refnanny' module");
22716  }
22717  #endif
22718  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_subsurfaceTransportFunctions(void)", 0);
22719  if (__Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22720  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22721  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22722  #ifdef __Pyx_CyFunction_USED
22723  if (__pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22724  #endif
22725  #ifdef __Pyx_FusedFunction_USED
22726  if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22727  #endif
22728  #ifdef __Pyx_Coroutine_USED
22729  if (__pyx_Coroutine_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22730  #endif
22731  #ifdef __Pyx_Generator_USED
22732  if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22733  #endif
22734  #ifdef __Pyx_StopAsyncIteration_USED
22735  if (__pyx_StopAsyncIteration_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22736  #endif
22737  /*--- Library function declarations ---*/
22738  /*--- Threads initialization code ---*/
22739  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
22740  #ifdef WITH_THREAD /* Python build with threading support? */
22741  PyEval_InitThreads();
22742  #endif
22743  #endif
22744  /*--- Module creation code ---*/
22745  #if PY_MAJOR_VERSION < 3
22746  __pyx_m = Py_InitModule4("subsurfaceTransportFunctions", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
22747  #else
22748  __pyx_m = PyModule_Create(&__pyx_moduledef);
22749  #endif
22750  if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22751  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22752  Py_INCREF(__pyx_d);
22753  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22754  #if CYTHON_COMPILING_IN_PYPY
22755  Py_INCREF(__pyx_b);
22756  #endif
22757  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
22758  /*--- Initialize various global constants etc. ---*/
22759  if (__Pyx_InitGlobals() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22760  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
22761  if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22762  #endif
22763  if (__pyx_module_is_main_subsurfaceTransportFunctions) {
22764  if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22765  }
22766  #if PY_MAJOR_VERSION >= 3
22767  {
22768  PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22769  if (!PyDict_GetItemString(modules, "subsurfaceTransportFunctions")) {
22770  if (unlikely(PyDict_SetItemString(modules, "subsurfaceTransportFunctions", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22771  }
22772  }
22773  #endif
22774  /*--- Builtin init code ---*/
22775  if (__Pyx_InitCachedBuiltins() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22776  /*--- Constants init code ---*/
22777  if (__Pyx_InitCachedConstants() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22778  /*--- Global init code ---*/
22779  /*--- Variable export code ---*/
22780  /*--- Function export code ---*/
22781  /*--- Type init code ---*/
22782  /*--- Type import code ---*/
22783  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type",
22784  #if CYTHON_COMPILING_IN_PYPY
22785  sizeof(PyTypeObject),
22786  #else
22787  sizeof(PyHeapTypeObject),
22788  #endif
22789  0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22790  __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22791  __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22792  __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22793  __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22794  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22795  /*--- Variable import code ---*/
22796  /*--- Function import code ---*/
22797  /*--- Execution code ---*/
22798  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
22799  if (__Pyx_patch_abc() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22800  #endif
22801 
22802  /* "subsurfaceTransportFunctions.pyx":1
22803  * import numpy # <<<<<<<<<<<<<<
22804  * cimport numpy
22805  * cdef extern from "math.h":
22806  */
22807  __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22808  __Pyx_GOTREF(__pyx_t_1);
22809  if (PyDict_SetItem(__pyx_d, __pyx_n_s_numpy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22810  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22811 
22812  /* "subsurfaceTransportFunctions.pyx":18
22813  * ctypedef int ITYPE_t
22814  *
22815  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global, # <<<<<<<<<<<<<<
22816  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundariesArray,
22817  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
22818  */
22819  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22820  __Pyx_GOTREF(__pyx_t_1);
22821  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setExteriorElementBoundaryTypes, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22822  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22823 
22824  /* "subsurfaceTransportFunctions.pyx":29
22825  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
22826  *
22827  * def setElementBoundariesArray(int nElementBoundaries_global, # <<<<<<<<<<<<<<
22828  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
22829  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
22830  */
22831  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_3setElementBoundariesArray, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22832  __Pyx_GOTREF(__pyx_t_1);
22833  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setElementBoundariesArray, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22834  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22835 
22836  /* "subsurfaceTransportFunctions.pyx":43
22837  *
22838  * ###
22839  * def setScalarMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
22840  * numpy.ndarray[DTYPE_t,ndim=2] q_vals,
22841  * dict material_functions):
22842  */
22843  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22844  __Pyx_GOTREF(__pyx_t_1);
22845  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setScalarMaterialFunctionOverEle, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22846  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22847 
22848  /* "subsurfaceTransportFunctions.pyx":56
22849  * q_vals[eN,k] = material_functions[material]
22850  *
22851  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
22852  * numpy.ndarray[DTYPE_t,ndim=3] q_vals,
22853  * dict material_functions):
22854  */
22855  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22856  __Pyx_GOTREF(__pyx_t_1);
22857  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setVectorMaterialFunctionOverEle, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22858  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22859 
22860  /* "subsurfaceTransportFunctions.pyx":69
22861  *
22862  *
22863  * def setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
22864  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
22865  * numpy.ndarray[DTYPE_t,ndim=3] ebq_vals,
22866  */
22867  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22868  __Pyx_GOTREF(__pyx_t_1);
22869  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setScalarMaterialFunctionOverEle_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22870  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22871 
22872  /* "subsurfaceTransportFunctions.pyx":91
22873  * material_functions[material_right])
22874  *
22875  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
22876  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
22877  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
22878  */
22879  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22880  __Pyx_GOTREF(__pyx_t_1);
22881  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setSparseTensorMaterialFunctionO, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22882  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22883 
22884  /* "subsurfaceTransportFunctions.pyx":118
22885  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
22886  *
22887  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
22888  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
22889  * numpy.ndarray[DTYPE_t,ndim=2] ebq_global_vals,
22890  */
22891  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22892  __Pyx_GOTREF(__pyx_t_1);
22893  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setScalarMaterialFunctionOverGlo, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22894  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22895 
22896  /* "subsurfaceTransportFunctions.pyx":139
22897  *
22898  *
22899  * def setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
22900  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
22901  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
22902  */
22903  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22904  __Pyx_GOTREF(__pyx_t_1);
22905  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setSparseTensorMaterialFunctionO_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22906  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22907 
22908  /* "subsurfaceTransportFunctions.pyx":165
22909  *
22910  * ###
22911  * def evaluateScalarMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
22912  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
22913  * numpy.ndarray[DTYPE_t,ndim=3] x,
22914  */
22915  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22916  __Pyx_GOTREF(__pyx_t_1);
22917  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateScalarMaterialFunctionOv, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22918  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22919 
22920  /* "subsurfaceTransportFunctions.pyx":180
22921  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
22922  *
22923  * def evaluateVectorMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
22924  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
22925  * numpy.ndarray[DTYPE_t,ndim=3] x,
22926  */
22927  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22928  __Pyx_GOTREF(__pyx_t_1);
22929  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateVectorMaterialFunctionOv, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22930  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22931 
22932  /* "subsurfaceTransportFunctions.pyx":195
22933  *
22934  *
22935  * def evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
22936  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
22937  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
22938  */
22939  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22940  __Pyx_GOTREF(__pyx_t_1);
22941  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateScalarMaterialFunctionOv_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22942  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22943 
22944  /* "subsurfaceTransportFunctions.pyx":219
22945  * material_functions[material_right](x[eN,ebN_local,k],t))
22946  *
22947  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
22948  * double t,
22949  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
22950  */
22951  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22952  __Pyx_GOTREF(__pyx_t_1);
22953  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateSparseTensorMaterialFunc, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22954  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22955 
22956  /* "subsurfaceTransportFunctions.pyx":248
22957  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
22958  *
22959  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
22960  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
22961  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
22962  */
22963  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22964  __Pyx_GOTREF(__pyx_t_1);
22965  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateScalarMaterialFunctionOv_3, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22966  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22967 
22968  /* "subsurfaceTransportFunctions.pyx":271
22969  *
22970  *
22971  * def evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
22972  * double t,
22973  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
22974  */
22975  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22976  __Pyx_GOTREF(__pyx_t_1);
22977  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateSparseTensorMaterialFunc_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22978  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22979 
22980  /* "subsurfaceTransportFunctions.pyx":301
22981  *
22982  * ##################################################
22983  * def RE_NCP1_evaluateElementCoefficients_Linear(double rho, # <<<<<<<<<<<<<<
22984  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
22985  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
22986  */
22987  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22988  __Pyx_GOTREF(__pyx_t_1);
22989  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RE_NCP1_evaluateElementCoefficie, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22990  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22991 
22992  /* "subsurfaceTransportFunctions.pyx":359
22993  *
22994  *
22995  * def RE_NCP1_evaluateElementCoefficients_VGM(double rho, # <<<<<<<<<<<<<<
22996  * double beta,
22997  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
22998  */
22999  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23000  __Pyx_GOTREF(__pyx_t_1);
23001  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RE_NCP1_evaluateElementCoefficie_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23002  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23003 
23004  /* "subsurfaceTransportFunctions.pyx":486
23005  * #eN for upwind
23006  *
23007  * def RE_NCP1_getElementResidual(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
23008  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
23009  * numpy.ndarray[ITYPE_t,ndim=1] colind,
23010  */
23011  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23012  __Pyx_GOTREF(__pyx_t_1);
23013  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RE_NCP1_getElementResidual, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23014  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23015 
23016  /* "subsurfaceTransportFunctions.pyx":574
23017  * #i
23018  * #eN
23019  * def RE_NCP1_getElementJacobian(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
23020  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
23021  * numpy.ndarray[ITYPE_t,ndim=1] colind,
23022  */
23023  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23024  __Pyx_GOTREF(__pyx_t_1);
23025  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RE_NCP1_getElementJacobian, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23026  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23027 
23028  /* "subsurfaceTransportFunctions.pyx":673
23029  * ##################################################
23030  *
23031  * def updateMass_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] mt, # <<<<<<<<<<<<<<
23032  * numpy.ndarray[DTYPE_t,ndim=3] w,
23033  * numpy.ndarray[DTYPE_t,ndim=2] dV,
23034  */
23035  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_37updateMass_weakAvg, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23036  __Pyx_GOTREF(__pyx_t_1);
23037  if (PyDict_SetItem(__pyx_d, __pyx_n_s_updateMass_weakAvg, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23038  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23039 
23040  /* "subsurfaceTransportFunctions.pyx":692
23041  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
23042  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
23043  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt, # <<<<<<<<<<<<<<
23044  * numpy.ndarray[DTYPE_t,ndim=3] w,
23045  * numpy.ndarray[DTYPE_t,ndim=3] v,
23046  */
23047  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23048  __Pyx_GOTREF(__pyx_t_1);
23049  if (PyDict_SetItem(__pyx_d, __pyx_n_s_updateMassJacobian_weakAvg, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23050  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23051 
23052  /* "subsurfaceTransportFunctions.pyx":717
23053  * #ELLAM
23054  * ########################################################################
23055  * def calculateNormalFlux(numpy.ndarray[DTYPE_t,ndim=4] v, # <<<<<<<<<<<<<<
23056  * numpy.ndarray[DTYPE_t,ndim=4] n,
23057  * numpy.ndarray[DTYPE_t,ndim=3] dS,
23058  */
23059  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_41calculateNormalFlux, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23060  __Pyx_GOTREF(__pyx_t_1);
23061  if (PyDict_SetItem(__pyx_d, __pyx_n_s_calculateNormalFlux, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23062  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23063 
23064  /* "subsurfaceTransportFunctions.pyx":732
23065  * flux[eN,ebN] = integral
23066  *
23067  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df, # <<<<<<<<<<<<<<
23068  * numpy.ndarray[DTYPE_t,ndim=3] characteristic_velocity,
23069  * numpy.ndarray[DTYPE_t,ndim=2] dm,
23070  */
23071  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23072  __Pyx_GOTREF(__pyx_t_1);
23073  if (PyDict_SetItem(__pyx_d, __pyx_n_s_computeSimpleCharacteristicVeloc, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23074  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23075 
23076  /* "subsurfaceTransportFunctions.pyx":753
23077  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
23078  *
23079  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs, # <<<<<<<<<<<<<<
23080  * numpy.ndarray[DTYPE_t,ndim=1] characteristic_velocity_dofs,
23081  * numpy.ndarray[ITYPE_t,ndim=2] l2g,
23082  */
23083  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23084  __Pyx_GOTREF(__pyx_t_1);
23085  if (PyDict_SetItem(__pyx_d, __pyx_n_s_computeSimpleCharacteristicVeloc_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23086  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23087 
23088  /* "subsurfaceTransportFunctions.pyx":776
23089  *
23090  * #problem specific velocity evaluation
23091  * def rotatingGaussianElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
23092  * double t,
23093  * double tForReversal,
23094  */
23095  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23096  __Pyx_GOTREF(__pyx_t_1);
23097  if (PyDict_SetItem(__pyx_d, __pyx_n_s_rotatingGaussianElementVelocityE, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23098  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23099 
23100  /* "subsurfaceTransportFunctions.pyx":816
23101  *
23102  *
23103  * def rotatingGaussianElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
23104  * double t,
23105  * double tForReversal,
23106  */
23107  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23108  __Pyx_GOTREF(__pyx_t_1);
23109  if (PyDict_SetItem(__pyx_d, __pyx_n_s_rotatingGaussianElementVelocityE_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23110  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23111 
23112  /* "subsurfaceTransportFunctions.pyx":859
23113  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
23114  *
23115  * def helicalElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
23116  * double t,
23117  * double tForReversal,
23118  */
23119  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_51helicalElementVelocityEval3, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23120  __Pyx_GOTREF(__pyx_t_1);
23121  if (PyDict_SetItem(__pyx_d, __pyx_n_s_helicalElementVelocityEval3, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23122  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23123 
23124  /* "subsurfaceTransportFunctions.pyx":884
23125  * v[eN,k,2]=zVelocity
23126  *
23127  * def helicalElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
23128  * double t,
23129  * double tForReversal,
23130  */
23131  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_53helicalElementVelocityEval4, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23132  __Pyx_GOTREF(__pyx_t_1);
23133  if (PyDict_SetItem(__pyx_d, __pyx_n_s_helicalElementVelocityEval4, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23134  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23135 
23136  /* "subsurfaceTransportFunctions.pyx":911
23137  * v[eN,ebN,k,2]=zVelocity
23138  *
23139  * def vortexElementVelocityEval3(double t, # <<<<<<<<<<<<<<
23140  * numpy.ndarray[DTYPE_t,ndim=3] x,
23141  * numpy.ndarray[DTYPE_t,ndim=3] v):
23142  */
23143  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_55vortexElementVelocityEval3, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23144  __Pyx_GOTREF(__pyx_t_1);
23145  if (PyDict_SetItem(__pyx_d, __pyx_n_s_vortexElementVelocityEval3, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23146  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23147 
23148  /* "subsurfaceTransportFunctions.pyx":924
23149  *
23150  *
23151  * def vortexElementVelocityEval4(double t, # <<<<<<<<<<<<<<
23152  * numpy.ndarray[DTYPE_t,ndim=4] x,
23153  * numpy.ndarray[DTYPE_t,ndim=4] v):
23154  */
23155  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_57vortexElementVelocityEval4, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23156  __Pyx_GOTREF(__pyx_t_1);
23157  if (PyDict_SetItem(__pyx_d, __pyx_n_s_vortexElementVelocityEval4, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23158  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23159 
23160  /* "subsurfaceTransportFunctions.pyx":1
23161  * import numpy # <<<<<<<<<<<<<<
23162  * cimport numpy
23163  * cdef extern from "math.h":
23164  */
23165  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23166  __Pyx_GOTREF(__pyx_t_1);
23167  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23168  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23169 
23170  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":976
23171  * arr.base = baseptr
23172  *
23173  * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
23174  * if arr.base is NULL:
23175  * return None
23176  */
23177 
23178  /*--- Wrapped vars code ---*/
23179 
23180  goto __pyx_L0;
23181  __pyx_L1_error:;
23182  __Pyx_XDECREF(__pyx_t_1);
23183  if (__pyx_m) {
23184  if (__pyx_d) {
23185  __Pyx_AddTraceback("init subsurfaceTransportFunctions", __pyx_clineno, __pyx_lineno, __pyx_filename);
23186  }
23187  Py_DECREF(__pyx_m); __pyx_m = 0;
23188  } else if (!PyErr_Occurred()) {
23189  PyErr_SetString(PyExc_ImportError, "init subsurfaceTransportFunctions");
23190  }
23191  __pyx_L0:;
23192  __Pyx_RefNannyFinishContext();
23193  #if PY_MAJOR_VERSION < 3
23194  return;
23195  #else
23196  return __pyx_m;
23197  #endif
23198 }
23199 
23200 /* --- Runtime support code --- */
23201 #if CYTHON_REFNANNY
23202 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
23203  PyObject *m = NULL, *p = NULL;
23204  void *r = NULL;
23205  m = PyImport_ImportModule((char *)modname);
23206  if (!m) goto end;
23207  p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
23208  if (!p) goto end;
23209  r = PyLong_AsVoidPtr(p);
23210 end:
23211  Py_XDECREF(p);
23212  Py_XDECREF(m);
23213  return (__Pyx_RefNannyAPIStruct *)r;
23214 }
23215 #endif
23216 
23217 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
23218  PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
23219  if (unlikely(!result)) {
23220  PyErr_Format(PyExc_NameError,
23221 #if PY_MAJOR_VERSION >= 3
23222  "name '%U' is not defined", name);
23223 #else
23224  "name '%.200s' is not defined", PyString_AS_STRING(name));
23225 #endif
23226  }
23227  return result;
23228 }
23229 
23230 static void __Pyx_RaiseArgtupleInvalid(
23231  const char* func_name,
23232  int exact,
23233  Py_ssize_t num_min,
23234  Py_ssize_t num_max,
23235  Py_ssize_t num_found)
23236 {
23237  Py_ssize_t num_expected;
23238  const char *more_or_less;
23239  if (num_found < num_min) {
23240  num_expected = num_min;
23241  more_or_less = "at least";
23242  } else {
23243  num_expected = num_max;
23244  more_or_less = "at most";
23245  }
23246  if (exact) {
23247  more_or_less = "exactly";
23248  }
23249  PyErr_Format(PyExc_TypeError,
23250  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
23251  func_name, more_or_less, num_expected,
23252  (num_expected == 1) ? "" : "s", num_found);
23253 }
23254 
23255 static void __Pyx_RaiseDoubleKeywordsError(
23256  const char* func_name,
23257  PyObject* kw_name)
23258 {
23259  PyErr_Format(PyExc_TypeError,
23260  #if PY_MAJOR_VERSION >= 3
23261  "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
23262  #else
23263  "%s() got multiple values for keyword argument '%s'", func_name,
23264  PyString_AsString(kw_name));
23265  #endif
23266 }
23267 
23268 static int __Pyx_ParseOptionalKeywords(
23269  PyObject *kwds,
23270  PyObject **argnames[],
23271  PyObject *kwds2,
23272  PyObject *values[],
23273  Py_ssize_t num_pos_args,
23274  const char* function_name)
23275 {
23276  PyObject *key = 0, *value = 0;
23277  Py_ssize_t pos = 0;
23278  PyObject*** name;
23279  PyObject*** first_kw_arg = argnames + num_pos_args;
23280  while (PyDict_Next(kwds, &pos, &key, &value)) {
23281  name = first_kw_arg;
23282  while (*name && (**name != key)) name++;
23283  if (*name) {
23284  values[name-argnames] = value;
23285  continue;
23286  }
23287  name = first_kw_arg;
23288  #if PY_MAJOR_VERSION < 3
23289  if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
23290  while (*name) {
23291  if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
23292  && _PyString_Eq(**name, key)) {
23293  values[name-argnames] = value;
23294  break;
23295  }
23296  name++;
23297  }
23298  if (*name) continue;
23299  else {
23300  PyObject*** argname = argnames;
23301  while (argname != first_kw_arg) {
23302  if ((**argname == key) || (
23303  (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
23304  && _PyString_Eq(**argname, key))) {
23305  goto arg_passed_twice;
23306  }
23307  argname++;
23308  }
23309  }
23310  } else
23311  #endif
23312  if (likely(PyUnicode_Check(key))) {
23313  while (*name) {
23314  int cmp = (**name == key) ? 0 :
23315  #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
23316  (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
23317  #endif
23318  PyUnicode_Compare(**name, key);
23319  if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
23320  if (cmp == 0) {
23321  values[name-argnames] = value;
23322  break;
23323  }
23324  name++;
23325  }
23326  if (*name) continue;
23327  else {
23328  PyObject*** argname = argnames;
23329  while (argname != first_kw_arg) {
23330  int cmp = (**argname == key) ? 0 :
23331  #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
23332  (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
23333  #endif
23334  PyUnicode_Compare(**argname, key);
23335  if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
23336  if (cmp == 0) goto arg_passed_twice;
23337  argname++;
23338  }
23339  }
23340  } else
23341  goto invalid_keyword_type;
23342  if (kwds2) {
23343  if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
23344  } else {
23345  goto invalid_keyword;
23346  }
23347  }
23348  return 0;
23349 arg_passed_twice:
23350  __Pyx_RaiseDoubleKeywordsError(function_name, key);
23351  goto bad;
23352 invalid_keyword_type:
23353  PyErr_Format(PyExc_TypeError,
23354  "%.200s() keywords must be strings", function_name);
23355  goto bad;
23356 invalid_keyword:
23357  PyErr_Format(PyExc_TypeError,
23358  #if PY_MAJOR_VERSION < 3
23359  "%.200s() got an unexpected keyword argument '%.200s'",
23360  function_name, PyString_AsString(key));
23361  #else
23362  "%s() got an unexpected keyword argument '%U'",
23363  function_name, key);
23364  #endif
23365 bad:
23366  return -1;
23367 }
23368 
23369 static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) {
23370  PyErr_Format(PyExc_TypeError,
23371  "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
23372  name, type->tp_name, Py_TYPE(obj)->tp_name);
23373 }
23374 static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
23375  const char *name, int exact)
23376 {
23377  if (unlikely(!type)) {
23378  PyErr_SetString(PyExc_SystemError, "Missing type object");
23379  return 0;
23380  }
23381  if (none_allowed && obj == Py_None) return 1;
23382  else if (exact) {
23383  if (likely(Py_TYPE(obj) == type)) return 1;
23384  #if PY_MAJOR_VERSION == 2
23385  else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
23386  #endif
23387  }
23388  else {
23389  if (likely(PyObject_TypeCheck(obj, type))) return 1;
23390  }
23391  __Pyx_RaiseArgumentTypeInvalid(name, obj, type);
23392  return 0;
23393 }
23394 
23395 static CYTHON_INLINE int __Pyx_IsLittleEndian(void) {
23396  unsigned int n = 1;
23397  return *(unsigned char*)(&n) != 0;
23398 }
23399 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
23400  __Pyx_BufFmt_StackElem* stack,
23401  __Pyx_TypeInfo* type) {
23402  stack[0].field = &ctx->root;
23403  stack[0].parent_offset = 0;
23404  ctx->root.type = type;
23405  ctx->root.name = "buffer dtype";
23406  ctx->root.offset = 0;
23407  ctx->head = stack;
23408  ctx->head->field = &ctx->root;
23409  ctx->fmt_offset = 0;
23410  ctx->head->parent_offset = 0;
23411  ctx->new_packmode = '@';
23412  ctx->enc_packmode = '@';
23413  ctx->new_count = 1;
23414  ctx->enc_count = 0;
23415  ctx->enc_type = 0;
23416  ctx->is_complex = 0;
23417  ctx->is_valid_array = 0;
23418  ctx->struct_alignment = 0;
23419  while (type->typegroup == 'S') {
23420  ++ctx->head;
23421  ctx->head->field = type->fields;
23422  ctx->head->parent_offset = 0;
23423  type = type->fields->type;
23424  }
23425 }
23426 static int __Pyx_BufFmt_ParseNumber(const char** ts) {
23427  int count;
23428  const char* t = *ts;
23429  if (*t < '0' || *t > '9') {
23430  return -1;
23431  } else {
23432  count = *t++ - '0';
23433  while (*t >= '0' && *t < '9') {
23434  count *= 10;
23435  count += *t++ - '0';
23436  }
23437  }
23438  *ts = t;
23439  return count;
23440 }
23441 static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
23442  int number = __Pyx_BufFmt_ParseNumber(ts);
23443  if (number == -1)
23444  PyErr_Format(PyExc_ValueError,\
23445  "Does not understand character buffer dtype format string ('%c')", **ts);
23446  return number;
23447 }
23448 static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
23449  PyErr_Format(PyExc_ValueError,
23450  "Unexpected format string character: '%c'", ch);
23451 }
23452 static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
23453  switch (ch) {
23454  case 'c': return "'char'";
23455  case 'b': return "'signed char'";
23456  case 'B': return "'unsigned char'";
23457  case 'h': return "'short'";
23458  case 'H': return "'unsigned short'";
23459  case 'i': return "'int'";
23460  case 'I': return "'unsigned int'";
23461  case 'l': return "'long'";
23462  case 'L': return "'unsigned long'";
23463  case 'q': return "'long long'";
23464  case 'Q': return "'unsigned long long'";
23465  case 'f': return (is_complex ? "'complex float'" : "'float'");
23466  case 'd': return (is_complex ? "'complex double'" : "'double'");
23467  case 'g': return (is_complex ? "'complex long double'" : "'long double'");
23468  case 'T': return "a struct";
23469  case 'O': return "Python object";
23470  case 'P': return "a pointer";
23471  case 's': case 'p': return "a string";
23472  case 0: return "end";
23473  default: return "unparseable format string";
23474  }
23475 }
23476 static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
23477  switch (ch) {
23478  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
23479  case 'h': case 'H': return 2;
23480  case 'i': case 'I': case 'l': case 'L': return 4;
23481  case 'q': case 'Q': return 8;
23482  case 'f': return (is_complex ? 8 : 4);
23483  case 'd': return (is_complex ? 16 : 8);
23484  case 'g': {
23485  PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
23486  return 0;
23487  }
23488  case 'O': case 'P': return sizeof(void*);
23489  default:
23490  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
23491  return 0;
23492  }
23493 }
23494 static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
23495  switch (ch) {
23496  case 'c': case 'b': case 'B': case 's': case 'p': return 1;
23497  case 'h': case 'H': return sizeof(short);
23498  case 'i': case 'I': return sizeof(int);
23499  case 'l': case 'L': return sizeof(long);
23500  #ifdef HAVE_LONG_LONG
23501  case 'q': case 'Q': return sizeof(PY_LONG_LONG);
23502  #endif
23503  case 'f': return sizeof(float) * (is_complex ? 2 : 1);
23504  case 'd': return sizeof(double) * (is_complex ? 2 : 1);
23505  case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
23506  case 'O': case 'P': return sizeof(void*);
23507  default: {
23508  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
23509  return 0;
23510  }
23511  }
23512 }
23513 typedef struct { char c; short x; } __Pyx_st_short;
23514 typedef struct { char c; int x; } __Pyx_st_int;
23515 typedef struct { char c; long x; } __Pyx_st_long;
23516 typedef struct { char c; float x; } __Pyx_st_float;
23517 typedef struct { char c; double x; } __Pyx_st_double;
23518 typedef struct { char c; long double x; } __Pyx_st_longdouble;
23519 typedef struct { char c; void *x; } __Pyx_st_void_p;
23520 #ifdef HAVE_LONG_LONG
23521 typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
23522 #endif
23523 static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
23524  switch (ch) {
23525  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
23526  case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
23527  case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
23528  case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
23529 #ifdef HAVE_LONG_LONG
23530  case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
23531 #endif
23532  case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
23533  case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
23534  case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
23535  case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
23536  default:
23537  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
23538  return 0;
23539  }
23540 }
23541 /* These are for computing the padding at the end of the struct to align
23542  on the first member of the struct. This will probably the same as above,
23543  but we don't have any guarantees.
23544  */
23545 typedef struct { short x; char c; } __Pyx_pad_short;
23546 typedef struct { int x; char c; } __Pyx_pad_int;
23547 typedef struct { long x; char c; } __Pyx_pad_long;
23548 typedef struct { float x; char c; } __Pyx_pad_float;
23549 typedef struct { double x; char c; } __Pyx_pad_double;
23550 typedef struct { long double x; char c; } __Pyx_pad_longdouble;
23551 typedef struct { void *x; char c; } __Pyx_pad_void_p;
23552 #ifdef HAVE_LONG_LONG
23553 typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
23554 #endif
23555 static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
23556  switch (ch) {
23557  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
23558  case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
23559  case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
23560  case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
23561 #ifdef HAVE_LONG_LONG
23562  case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
23563 #endif
23564  case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
23565  case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
23566  case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
23567  case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
23568  default:
23569  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
23570  return 0;
23571  }
23572 }
23573 static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
23574  switch (ch) {
23575  case 'c':
23576  return 'H';
23577  case 'b': case 'h': case 'i':
23578  case 'l': case 'q': case 's': case 'p':
23579  return 'I';
23580  case 'B': case 'H': case 'I': case 'L': case 'Q':
23581  return 'U';
23582  case 'f': case 'd': case 'g':
23583  return (is_complex ? 'C' : 'R');
23584  case 'O':
23585  return 'O';
23586  case 'P':
23587  return 'P';
23588  default: {
23589  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
23590  return 0;
23591  }
23592  }
23593 }
23594 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
23595  if (ctx->head == NULL || ctx->head->field == &ctx->root) {
23596  const char* expected;
23597  const char* quote;
23598  if (ctx->head == NULL) {
23599  expected = "end";
23600  quote = "";
23601  } else {
23602  expected = ctx->head->field->type->name;
23603  quote = "'";
23604  }
23605  PyErr_Format(PyExc_ValueError,
23606  "Buffer dtype mismatch, expected %s%s%s but got %s",
23607  quote, expected, quote,
23608  __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
23609  } else {
23610  __Pyx_StructField* field = ctx->head->field;
23611  __Pyx_StructField* parent = (ctx->head - 1)->field;
23612  PyErr_Format(PyExc_ValueError,
23613  "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
23614  field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
23615  parent->type->name, field->name);
23616  }
23617 }
23618 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
23619  char group;
23620  size_t size, offset, arraysize = 1;
23621  if (ctx->enc_type == 0) return 0;
23622  if (ctx->head->field->type->arraysize[0]) {
23623  int i, ndim = 0;
23624  if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
23625  ctx->is_valid_array = ctx->head->field->type->ndim == 1;
23626  ndim = 1;
23627  if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
23628  PyErr_Format(PyExc_ValueError,
23629  "Expected a dimension of size %zu, got %zu",
23630  ctx->head->field->type->arraysize[0], ctx->enc_count);
23631  return -1;
23632  }
23633  }
23634  if (!ctx->is_valid_array) {
23635  PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
23636  ctx->head->field->type->ndim, ndim);
23637  return -1;
23638  }
23639  for (i = 0; i < ctx->head->field->type->ndim; i++) {
23640  arraysize *= ctx->head->field->type->arraysize[i];
23641  }
23642  ctx->is_valid_array = 0;
23643  ctx->enc_count = 1;
23644  }
23645  group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
23646  do {
23647  __Pyx_StructField* field = ctx->head->field;
23648  __Pyx_TypeInfo* type = field->type;
23649  if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
23650  size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
23651  } else {
23652  size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
23653  }
23654  if (ctx->enc_packmode == '@') {
23655  size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
23656  size_t align_mod_offset;
23657  if (align_at == 0) return -1;
23658  align_mod_offset = ctx->fmt_offset % align_at;
23659  if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
23660  if (ctx->struct_alignment == 0)
23661  ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
23662  ctx->is_complex);
23663  }
23664  if (type->size != size || type->typegroup != group) {
23665  if (type->typegroup == 'C' && type->fields != NULL) {
23666  size_t parent_offset = ctx->head->parent_offset + field->offset;
23667  ++ctx->head;
23668  ctx->head->field = type->fields;
23669  ctx->head->parent_offset = parent_offset;
23670  continue;
23671  }
23672  if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
23673  } else {
23674  __Pyx_BufFmt_RaiseExpected(ctx);
23675  return -1;
23676  }
23677  }
23678  offset = ctx->head->parent_offset + field->offset;
23679  if (ctx->fmt_offset != offset) {
23680  PyErr_Format(PyExc_ValueError,
23681  "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
23682  (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
23683  return -1;
23684  }
23685  ctx->fmt_offset += size;
23686  if (arraysize)
23687  ctx->fmt_offset += (arraysize - 1) * size;
23688  --ctx->enc_count;
23689  while (1) {
23690  if (field == &ctx->root) {
23691  ctx->head = NULL;
23692  if (ctx->enc_count != 0) {
23693  __Pyx_BufFmt_RaiseExpected(ctx);
23694  return -1;
23695  }
23696  break;
23697  }
23698  ctx->head->field = ++field;
23699  if (field->type == NULL) {
23700  --ctx->head;
23701  field = ctx->head->field;
23702  continue;
23703  } else if (field->type->typegroup == 'S') {
23704  size_t parent_offset = ctx->head->parent_offset + field->offset;
23705  if (field->type->fields->type == NULL) continue;
23706  field = field->type->fields;
23707  ++ctx->head;
23708  ctx->head->field = field;
23709  ctx->head->parent_offset = parent_offset;
23710  break;
23711  } else {
23712  break;
23713  }
23714  }
23715  } while (ctx->enc_count);
23716  ctx->enc_type = 0;
23717  ctx->is_complex = 0;
23718  return 0;
23719 }
23720 static CYTHON_INLINE PyObject *
23721 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
23722 {
23723  const char *ts = *tsp;
23724  int i = 0, number;
23725  int ndim = ctx->head->field->type->ndim;
23726 ;
23727  ++ts;
23728  if (ctx->new_count != 1) {
23729  PyErr_SetString(PyExc_ValueError,
23730  "Cannot handle repeated arrays in format string");
23731  return NULL;
23732  }
23733  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
23734  while (*ts && *ts != ')') {
23735  switch (*ts) {
23736  case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue;
23737  default: break;
23738  }
23739  number = __Pyx_BufFmt_ExpectNumber(&ts);
23740  if (number == -1) return NULL;
23741  if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
23742  return PyErr_Format(PyExc_ValueError,
23743  "Expected a dimension of size %zu, got %d",
23744  ctx->head->field->type->arraysize[i], number);
23745  if (*ts != ',' && *ts != ')')
23746  return PyErr_Format(PyExc_ValueError,
23747  "Expected a comma in format string, got '%c'", *ts);
23748  if (*ts == ',') ts++;
23749  i++;
23750  }
23751  if (i != ndim)
23752  return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
23753  ctx->head->field->type->ndim, i);
23754  if (!*ts) {
23755  PyErr_SetString(PyExc_ValueError,
23756  "Unexpected end of format string, expected ')'");
23757  return NULL;
23758  }
23759  ctx->is_valid_array = 1;
23760  ctx->new_count = 1;
23761  *tsp = ++ts;
23762  return Py_None;
23763 }
23764 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
23765  int got_Z = 0;
23766  while (1) {
23767  switch(*ts) {
23768  case 0:
23769  if (ctx->enc_type != 0 && ctx->head == NULL) {
23770  __Pyx_BufFmt_RaiseExpected(ctx);
23771  return NULL;
23772  }
23773  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
23774  if (ctx->head != NULL) {
23775  __Pyx_BufFmt_RaiseExpected(ctx);
23776  return NULL;
23777  }
23778  return ts;
23779  case ' ':
23780  case '\r':
23781  case '\n':
23782  ++ts;
23783  break;
23784  case '<':
23785  if (!__Pyx_IsLittleEndian()) {
23786  PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
23787  return NULL;
23788  }
23789  ctx->new_packmode = '=';
23790  ++ts;
23791  break;
23792  case '>':
23793  case '!':
23794  if (__Pyx_IsLittleEndian()) {
23795  PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
23796  return NULL;
23797  }
23798  ctx->new_packmode = '=';
23799  ++ts;
23800  break;
23801  case '=':
23802  case '@':
23803  case '^':
23804  ctx->new_packmode = *ts++;
23805  break;
23806  case 'T':
23807  {
23808  const char* ts_after_sub;
23809  size_t i, struct_count = ctx->new_count;
23810  size_t struct_alignment = ctx->struct_alignment;
23811  ctx->new_count = 1;
23812  ++ts;
23813  if (*ts != '{') {
23814  PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
23815  return NULL;
23816  }
23817  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
23818  ctx->enc_type = 0;
23819  ctx->enc_count = 0;
23820  ctx->struct_alignment = 0;
23821  ++ts;
23822  ts_after_sub = ts;
23823  for (i = 0; i != struct_count; ++i) {
23824  ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
23825  if (!ts_after_sub) return NULL;
23826  }
23827  ts = ts_after_sub;
23828  if (struct_alignment) ctx->struct_alignment = struct_alignment;
23829  }
23830  break;
23831  case '}':
23832  {
23833  size_t alignment = ctx->struct_alignment;
23834  ++ts;
23835  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
23836  ctx->enc_type = 0;
23837  if (alignment && ctx->fmt_offset % alignment) {
23838  ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
23839  }
23840  }
23841  return ts;
23842  case 'x':
23843  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
23844  ctx->fmt_offset += ctx->new_count;
23845  ctx->new_count = 1;
23846  ctx->enc_count = 0;
23847  ctx->enc_type = 0;
23848  ctx->enc_packmode = ctx->new_packmode;
23849  ++ts;
23850  break;
23851  case 'Z':
23852  got_Z = 1;
23853  ++ts;
23854  if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
23855  __Pyx_BufFmt_RaiseUnexpectedChar('Z');
23856  return NULL;
23857  }
23858  case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
23859  case 'l': case 'L': case 'q': case 'Q':
23860  case 'f': case 'd': case 'g':
23861  case 'O': case 'p':
23862  if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
23863  ctx->enc_packmode == ctx->new_packmode) {
23864  ctx->enc_count += ctx->new_count;
23865  ctx->new_count = 1;
23866  got_Z = 0;
23867  ++ts;
23868  break;
23869  }
23870  case 's':
23871  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
23872  ctx->enc_count = ctx->new_count;
23873  ctx->enc_packmode = ctx->new_packmode;
23874  ctx->enc_type = *ts;
23875  ctx->is_complex = got_Z;
23876  ++ts;
23877  ctx->new_count = 1;
23878  got_Z = 0;
23879  break;
23880  case ':':
23881  ++ts;
23882  while(*ts != ':') ++ts;
23883  ++ts;
23884  break;
23885  case '(':
23886  if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
23887  break;
23888  default:
23889  {
23890  int number = __Pyx_BufFmt_ExpectNumber(&ts);
23891  if (number == -1) return NULL;
23892  ctx->new_count = (size_t)number;
23893  }
23894  }
23895  }
23896 }
23897 static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) {
23898  buf->buf = NULL;
23899  buf->obj = NULL;
23900  buf->strides = __Pyx_zeros;
23901  buf->shape = __Pyx_zeros;
23902  buf->suboffsets = __Pyx_minusones;
23903 }
23904 static CYTHON_INLINE int __Pyx_GetBufferAndValidate(
23905  Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags,
23906  int nd, int cast, __Pyx_BufFmt_StackElem* stack)
23907 {
23908  if (obj == Py_None || obj == NULL) {
23909  __Pyx_ZeroBuffer(buf);
23910  return 0;
23911  }
23912  buf->buf = NULL;
23913  if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail;
23914  if (buf->ndim != nd) {
23915  PyErr_Format(PyExc_ValueError,
23916  "Buffer has wrong number of dimensions (expected %d, got %d)",
23917  nd, buf->ndim);
23918  goto fail;
23919  }
23920  if (!cast) {
23921  __Pyx_BufFmt_Context ctx;
23922  __Pyx_BufFmt_Init(&ctx, stack, dtype);
23923  if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
23924  }
23925  if ((unsigned)buf->itemsize != dtype->size) {
23926  PyErr_Format(PyExc_ValueError,
23927  "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
23928  buf->itemsize, (buf->itemsize > 1) ? "s" : "",
23929  dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
23930  goto fail;
23931  }
23932  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
23933  return 0;
23934 fail:;
23935  __Pyx_ZeroBuffer(buf);
23936  return -1;
23937 }
23938 static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
23939  if (info->buf == NULL) return;
23940  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
23941  __Pyx_ReleaseBuffer(info);
23942 }
23943 
23944 static void __Pyx_RaiseBufferIndexError(int axis) {
23945  PyErr_Format(PyExc_IndexError,
23946  "Out of bounds on buffer access (axis %d)", axis);
23947 }
23948 
23949 static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
23950 #if CYTHON_COMPILING_IN_CPYTHON
23951  PyObject *tmp_type, *tmp_value, *tmp_tb;
23952  PyThreadState *tstate = PyThreadState_GET();
23953  tmp_type = tstate->curexc_type;
23954  tmp_value = tstate->curexc_value;
23955  tmp_tb = tstate->curexc_traceback;
23956  tstate->curexc_type = type;
23957  tstate->curexc_value = value;
23958  tstate->curexc_traceback = tb;
23959  Py_XDECREF(tmp_type);
23960  Py_XDECREF(tmp_value);
23961  Py_XDECREF(tmp_tb);
23962 #else
23963  PyErr_Restore(type, value, tb);
23964 #endif
23965 }
23966 static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
23967 #if CYTHON_COMPILING_IN_CPYTHON
23968  PyThreadState *tstate = PyThreadState_GET();
23969  *type = tstate->curexc_type;
23970  *value = tstate->curexc_value;
23971  *tb = tstate->curexc_traceback;
23972  tstate->curexc_type = 0;
23973  tstate->curexc_value = 0;
23974  tstate->curexc_traceback = 0;
23975 #else
23976  PyErr_Fetch(type, value, tb);
23977 #endif
23978 }
23979 
23980 #if CYTHON_USE_PYLONG_INTERNALS
23981  #include "longintrepr.h"
23982 #endif
23983 
23984 #if CYTHON_COMPILING_IN_CPYTHON
23985 static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floatval, CYTHON_UNUSED int inplace) {
23986  const double b = floatval;
23987  double a, result;
23988  if (likely(PyFloat_CheckExact(op1))) {
23989  a = PyFloat_AS_DOUBLE(op1);
23990  } else
23991  #if PY_MAJOR_VERSION < 3
23992  if (likely(PyInt_CheckExact(op1))) {
23993  a = (double) PyInt_AS_LONG(op1);
23994  } else
23995  #endif
23996  if (likely(PyLong_CheckExact(op1))) {
23997  #if CYTHON_USE_PYLONG_INTERNALS && PY_MAJOR_VERSION >= 3
23998  const digit* digits = ((PyLongObject*)op1)->ob_digit;
23999  const Py_ssize_t size = Py_SIZE(op1);
24000  switch (size) {
24001  case 0: a = 0.0; break;
24002  case -1: a = -(double) digits[0]; break;
24003  case 1: a = (double) digits[0]; break;
24004  case -2:
24005  case 2:
24006  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
24007  a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
24008  if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) (1L<<53))) {
24009  if (size == -2)
24010  a = -a;
24011  break;
24012  }
24013  }
24014  case -3:
24015  case 3:
24016  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
24017  a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
24018  if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) (1L<<53))) {
24019  if (size == -3)
24020  a = -a;
24021  break;
24022  }
24023  }
24024  case -4:
24025  case 4:
24026  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
24027  a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
24028  if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) (1L<<53))) {
24029  if (size == -4)
24030  a = -a;
24031  break;
24032  }
24033  }
24034  default:
24035  #else
24036  {
24037  #endif
24038  a = PyLong_AsDouble(op1);
24039  if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL;
24040  }
24041  } else {
24042  return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
24043  }
24044  PyFPE_START_PROTECT("add", return NULL)
24045  result = a + b;
24046  PyFPE_END_PROTECT(result)
24047  return PyFloat_FromDouble(result);
24048 }
24049 #endif
24050 
24051 #if CYTHON_COMPILING_IN_CPYTHON
24052 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
24053  PyObject *result;
24054  ternaryfunc call = func->ob_type->tp_call;
24055  if (unlikely(!call))
24056  return PyObject_Call(func, arg, kw);
24057  if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
24058  return NULL;
24059  result = (*call)(func, arg, kw);
24060  Py_LeaveRecursiveCall();
24061  if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
24062  PyErr_SetString(
24063  PyExc_SystemError,
24064  "NULL result without error in PyObject_Call");
24065  }
24066  return result;
24067 }
24068 #endif
24069 
24070 static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
24071  PyObject *result;
24072 #if CYTHON_COMPILING_IN_CPYTHON
24073  result = PyDict_GetItem(__pyx_d, name);
24074  if (likely(result)) {
24075  Py_INCREF(result);
24076  } else {
24077 #else
24078  result = PyObject_GetItem(__pyx_d, name);
24079  if (!result) {
24080  PyErr_Clear();
24081 #endif
24082  result = __Pyx_GetBuiltinName(name);
24083  }
24084  return result;
24085 }
24086 
24087 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
24088  if (unlikely(!type)) {
24089  PyErr_SetString(PyExc_SystemError, "Missing type object");
24090  return 0;
24091  }
24092  if (likely(PyObject_TypeCheck(obj, type)))
24093  return 1;
24094  PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
24095  Py_TYPE(obj)->tp_name, type->tp_name);
24096  return 0;
24097 }
24098 
24099 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
24100  PyObject *r;
24101  if (!j) return NULL;
24102  r = PyObject_GetItem(o, j);
24103  Py_DECREF(j);
24104  return r;
24105 }
24106 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
24107  CYTHON_NCP_UNUSED int wraparound,
24108  CYTHON_NCP_UNUSED int boundscheck) {
24109 #if CYTHON_COMPILING_IN_CPYTHON
24110  if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
24111  if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
24112  PyObject *r = PyList_GET_ITEM(o, i);
24113  Py_INCREF(r);
24114  return r;
24115  }
24116  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
24117 #else
24118  return PySequence_GetItem(o, i);
24119 #endif
24120 }
24121 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
24122  CYTHON_NCP_UNUSED int wraparound,
24123  CYTHON_NCP_UNUSED int boundscheck) {
24124 #if CYTHON_COMPILING_IN_CPYTHON
24125  if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
24126  if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
24127  PyObject *r = PyTuple_GET_ITEM(o, i);
24128  Py_INCREF(r);
24129  return r;
24130  }
24131  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
24132 #else
24133  return PySequence_GetItem(o, i);
24134 #endif
24135 }
24136 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
24137  CYTHON_NCP_UNUSED int wraparound,
24138  CYTHON_NCP_UNUSED int boundscheck) {
24139 #if CYTHON_COMPILING_IN_CPYTHON
24140  if (is_list || PyList_CheckExact(o)) {
24141  Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
24142  if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
24143  PyObject *r = PyList_GET_ITEM(o, n);
24144  Py_INCREF(r);
24145  return r;
24146  }
24147  }
24148  else if (PyTuple_CheckExact(o)) {
24149  Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
24150  if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
24151  PyObject *r = PyTuple_GET_ITEM(o, n);
24152  Py_INCREF(r);
24153  return r;
24154  }
24155  } else {
24156  PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
24157  if (likely(m && m->sq_item)) {
24158  if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
24159  Py_ssize_t l = m->sq_length(o);
24160  if (likely(l >= 0)) {
24161  i += l;
24162  } else {
24163  if (PyErr_ExceptionMatches(PyExc_OverflowError))
24164  PyErr_Clear();
24165  else
24166  return NULL;
24167  }
24168  }
24169  return m->sq_item(o, i);
24170  }
24171  }
24172 #else
24173  if (is_list || PySequence_Check(o)) {
24174  return PySequence_GetItem(o, i);
24175  }
24176 #endif
24177  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
24178 }
24179 
24180 #if CYTHON_COMPILING_IN_CPYTHON
24181 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
24182  PyObject *self, *result;
24183  PyCFunction cfunc;
24184  cfunc = PyCFunction_GET_FUNCTION(func);
24185  self = PyCFunction_GET_SELF(func);
24186  if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
24187  return NULL;
24188  result = cfunc(self, arg);
24189  Py_LeaveRecursiveCall();
24190  if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
24191  PyErr_SetString(
24192  PyExc_SystemError,
24193  "NULL result without error in PyObject_Call");
24194  }
24195  return result;
24196 }
24197 #endif
24198 
24199 #if CYTHON_COMPILING_IN_CPYTHON
24200 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
24201  PyObject *result;
24202  PyObject *args = PyTuple_New(1);
24203  if (unlikely(!args)) return NULL;
24204  Py_INCREF(arg);
24205  PyTuple_SET_ITEM(args, 0, arg);
24206  result = __Pyx_PyObject_Call(func, args, NULL);
24207  Py_DECREF(args);
24208  return result;
24209 }
24210 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
24211 #ifdef __Pyx_CyFunction_USED
24212  if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
24213 #else
24214  if (likely(PyCFunction_Check(func))) {
24215 #endif
24216  if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
24217  return __Pyx_PyObject_CallMethO(func, arg);
24218  }
24219  }
24220  return __Pyx__PyObject_CallOneArg(func, arg);
24221 }
24222 #else
24223 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
24224  PyObject *result;
24225  PyObject *args = PyTuple_Pack(1, arg);
24226  if (unlikely(!args)) return NULL;
24227  result = __Pyx_PyObject_Call(func, args, NULL);
24228  Py_DECREF(args);
24229  return result;
24230 }
24231 #endif
24232 
24233 static double __Pyx__PyObject_AsDouble(PyObject* obj) {
24234  PyObject* float_value;
24235 #if CYTHON_COMPILING_IN_PYPY
24236  float_value = PyNumber_Float(obj); if (0) goto bad;
24237 #else
24238  PyNumberMethods *nb = Py_TYPE(obj)->tp_as_number;
24239  if (likely(nb) && likely(nb->nb_float)) {
24240  float_value = nb->nb_float(obj);
24241  if (likely(float_value) && unlikely(!PyFloat_Check(float_value))) {
24242  PyErr_Format(PyExc_TypeError,
24243  "__float__ returned non-float (type %.200s)",
24244  Py_TYPE(float_value)->tp_name);
24245  Py_DECREF(float_value);
24246  goto bad;
24247  }
24248  } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) {
24249 #if PY_MAJOR_VERSION >= 3
24250  float_value = PyFloat_FromString(obj);
24251 #else
24252  float_value = PyFloat_FromString(obj, 0);
24253 #endif
24254  } else {
24255  PyObject* args = PyTuple_New(1);
24256  if (unlikely(!args)) goto bad;
24257  PyTuple_SET_ITEM(args, 0, obj);
24258  float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0);
24259  PyTuple_SET_ITEM(args, 0, 0);
24260  Py_DECREF(args);
24261  }
24262 #endif
24263  if (likely(float_value)) {
24264  double value = PyFloat_AS_DOUBLE(float_value);
24265  Py_DECREF(float_value);
24266  return value;
24267  }
24268 bad:
24269  return (double)-1;
24270 }
24271 
24272 #if PY_MAJOR_VERSION < 3
24273 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
24274  CYTHON_UNUSED PyObject *cause) {
24275  Py_XINCREF(type);
24276  if (!value || value == Py_None)
24277  value = NULL;
24278  else
24279  Py_INCREF(value);
24280  if (!tb || tb == Py_None)
24281  tb = NULL;
24282  else {
24283  Py_INCREF(tb);
24284  if (!PyTraceBack_Check(tb)) {
24285  PyErr_SetString(PyExc_TypeError,
24286  "raise: arg 3 must be a traceback or None");
24287  goto raise_error;
24288  }
24289  }
24290  if (PyType_Check(type)) {
24291 #if CYTHON_COMPILING_IN_PYPY
24292  if (!value) {
24293  Py_INCREF(Py_None);
24294  value = Py_None;
24295  }
24296 #endif
24297  PyErr_NormalizeException(&type, &value, &tb);
24298  } else {
24299  if (value) {
24300  PyErr_SetString(PyExc_TypeError,
24301  "instance exception may not have a separate value");
24302  goto raise_error;
24303  }
24304  value = type;
24305  type = (PyObject*) Py_TYPE(type);
24306  Py_INCREF(type);
24307  if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
24308  PyErr_SetString(PyExc_TypeError,
24309  "raise: exception class must be a subclass of BaseException");
24310  goto raise_error;
24311  }
24312  }
24313  __Pyx_ErrRestore(type, value, tb);
24314  return;
24315 raise_error:
24316  Py_XDECREF(value);
24317  Py_XDECREF(type);
24318  Py_XDECREF(tb);
24319  return;
24320 }
24321 #else
24322 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
24323  PyObject* owned_instance = NULL;
24324  if (tb == Py_None) {
24325  tb = 0;
24326  } else if (tb && !PyTraceBack_Check(tb)) {
24327  PyErr_SetString(PyExc_TypeError,
24328  "raise: arg 3 must be a traceback or None");
24329  goto bad;
24330  }
24331  if (value == Py_None)
24332  value = 0;
24333  if (PyExceptionInstance_Check(type)) {
24334  if (value) {
24335  PyErr_SetString(PyExc_TypeError,
24336  "instance exception may not have a separate value");
24337  goto bad;
24338  }
24339  value = type;
24340  type = (PyObject*) Py_TYPE(value);
24341  } else if (PyExceptionClass_Check(type)) {
24342  PyObject *instance_class = NULL;
24343  if (value && PyExceptionInstance_Check(value)) {
24344  instance_class = (PyObject*) Py_TYPE(value);
24345  if (instance_class != type) {
24346  int is_subclass = PyObject_IsSubclass(instance_class, type);
24347  if (!is_subclass) {
24348  instance_class = NULL;
24349  } else if (unlikely(is_subclass == -1)) {
24350  goto bad;
24351  } else {
24352  type = instance_class;
24353  }
24354  }
24355  }
24356  if (!instance_class) {
24357  PyObject *args;
24358  if (!value)
24359  args = PyTuple_New(0);
24360  else if (PyTuple_Check(value)) {
24361  Py_INCREF(value);
24362  args = value;
24363  } else
24364  args = PyTuple_Pack(1, value);
24365  if (!args)
24366  goto bad;
24367  owned_instance = PyObject_Call(type, args, NULL);
24368  Py_DECREF(args);
24369  if (!owned_instance)
24370  goto bad;
24371  value = owned_instance;
24372  if (!PyExceptionInstance_Check(value)) {
24373  PyErr_Format(PyExc_TypeError,
24374  "calling %R should have returned an instance of "
24375  "BaseException, not %R",
24376  type, Py_TYPE(value));
24377  goto bad;
24378  }
24379  }
24380  } else {
24381  PyErr_SetString(PyExc_TypeError,
24382  "raise: exception class must be a subclass of BaseException");
24383  goto bad;
24384  }
24385 #if PY_VERSION_HEX >= 0x03030000
24386  if (cause) {
24387 #else
24388  if (cause && cause != Py_None) {
24389 #endif
24390  PyObject *fixed_cause;
24391  if (cause == Py_None) {
24392  fixed_cause = NULL;
24393  } else if (PyExceptionClass_Check(cause)) {
24394  fixed_cause = PyObject_CallObject(cause, NULL);
24395  if (fixed_cause == NULL)
24396  goto bad;
24397  } else if (PyExceptionInstance_Check(cause)) {
24398  fixed_cause = cause;
24399  Py_INCREF(fixed_cause);
24400  } else {
24401  PyErr_SetString(PyExc_TypeError,
24402  "exception causes must derive from "
24403  "BaseException");
24404  goto bad;
24405  }
24406  PyException_SetCause(value, fixed_cause);
24407  }
24408  PyErr_SetObject(type, value);
24409  if (tb) {
24410 #if CYTHON_COMPILING_IN_PYPY
24411  PyObject *tmp_type, *tmp_value, *tmp_tb;
24412  PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
24413  Py_INCREF(tb);
24414  PyErr_Restore(tmp_type, tmp_value, tb);
24415  Py_XDECREF(tmp_tb);
24416 #else
24417  PyThreadState *tstate = PyThreadState_GET();
24418  PyObject* tmp_tb = tstate->curexc_traceback;
24419  if (tb != tmp_tb) {
24420  Py_INCREF(tb);
24421  tstate->curexc_traceback = tb;
24422  Py_XDECREF(tmp_tb);
24423  }
24424 #endif
24425  }
24426 bad:
24427  Py_XDECREF(owned_instance);
24428  return;
24429 }
24430 #endif
24431 
24432 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
24433  PyErr_Format(PyExc_ValueError,
24434  "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
24435 }
24436 
24437 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
24438  PyErr_Format(PyExc_ValueError,
24439  "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
24440  index, (index == 1) ? "" : "s");
24441 }
24442 
24443 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
24444  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
24445 }
24446 
24447 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
24448  PyObject *empty_list = 0;
24449  PyObject *module = 0;
24450  PyObject *global_dict = 0;
24451  PyObject *empty_dict = 0;
24452  PyObject *list;
24453  #if PY_VERSION_HEX < 0x03030000
24454  PyObject *py_import;
24455  py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
24456  if (!py_import)
24457  goto bad;
24458  #endif
24459  if (from_list)
24460  list = from_list;
24461  else {
24462  empty_list = PyList_New(0);
24463  if (!empty_list)
24464  goto bad;
24465  list = empty_list;
24466  }
24467  global_dict = PyModule_GetDict(__pyx_m);
24468  if (!global_dict)
24469  goto bad;
24470  empty_dict = PyDict_New();
24471  if (!empty_dict)
24472  goto bad;
24473  {
24474  #if PY_MAJOR_VERSION >= 3
24475  if (level == -1) {
24476  if (strchr(__Pyx_MODULE_NAME, '.')) {
24477  #if PY_VERSION_HEX < 0x03030000
24478  PyObject *py_level = PyInt_FromLong(1);
24479  if (!py_level)
24480  goto bad;
24481  module = PyObject_CallFunctionObjArgs(py_import,
24482  name, global_dict, empty_dict, list, py_level, NULL);
24483  Py_DECREF(py_level);
24484  #else
24485  module = PyImport_ImportModuleLevelObject(
24486  name, global_dict, empty_dict, list, 1);
24487  #endif
24488  if (!module) {
24489  if (!PyErr_ExceptionMatches(PyExc_ImportError))
24490  goto bad;
24491  PyErr_Clear();
24492  }
24493  }
24494  level = 0;
24495  }
24496  #endif
24497  if (!module) {
24498  #if PY_VERSION_HEX < 0x03030000
24499  PyObject *py_level = PyInt_FromLong(level);
24500  if (!py_level)
24501  goto bad;
24502  module = PyObject_CallFunctionObjArgs(py_import,
24503  name, global_dict, empty_dict, list, py_level, NULL);
24504  Py_DECREF(py_level);
24505  #else
24506  module = PyImport_ImportModuleLevelObject(
24507  name, global_dict, empty_dict, list, level);
24508  #endif
24509  }
24510  }
24511 bad:
24512  #if PY_VERSION_HEX < 0x03030000
24513  Py_XDECREF(py_import);
24514  #endif
24515  Py_XDECREF(empty_list);
24516  Py_XDECREF(empty_dict);
24517  return module;
24518 }
24519 
24520 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
24521  int start = 0, mid = 0, end = count - 1;
24522  if (end >= 0 && code_line > entries[end].code_line) {
24523  return count;
24524  }
24525  while (start < end) {
24526  mid = start + (end - start) / 2;
24527  if (code_line < entries[mid].code_line) {
24528  end = mid;
24529  } else if (code_line > entries[mid].code_line) {
24530  start = mid + 1;
24531  } else {
24532  return mid;
24533  }
24534  }
24535  if (code_line <= entries[mid].code_line) {
24536  return mid;
24537  } else {
24538  return mid + 1;
24539  }
24540 }
24541 static PyCodeObject *__pyx_find_code_object(int code_line) {
24542  PyCodeObject* code_object;
24543  int pos;
24544  if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
24545  return NULL;
24546  }
24547  pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
24548  if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
24549  return NULL;
24550  }
24551  code_object = __pyx_code_cache.entries[pos].code_object;
24552  Py_INCREF(code_object);
24553  return code_object;
24554 }
24555 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
24556  int pos, i;
24557  __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
24558  if (unlikely(!code_line)) {
24559  return;
24560  }
24561  if (unlikely(!entries)) {
24562  entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
24563  if (likely(entries)) {
24564  __pyx_code_cache.entries = entries;
24565  __pyx_code_cache.max_count = 64;
24566  __pyx_code_cache.count = 1;
24567  entries[0].code_line = code_line;
24568  entries[0].code_object = code_object;
24569  Py_INCREF(code_object);
24570  }
24571  return;
24572  }
24573  pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
24574  if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
24575  PyCodeObject* tmp = entries[pos].code_object;
24576  entries[pos].code_object = code_object;
24577  Py_DECREF(tmp);
24578  return;
24579  }
24580  if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
24581  int new_max = __pyx_code_cache.max_count + 64;
24582  entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
24583  __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
24584  if (unlikely(!entries)) {
24585  return;
24586  }
24587  __pyx_code_cache.entries = entries;
24588  __pyx_code_cache.max_count = new_max;
24589  }
24590  for (i=__pyx_code_cache.count; i>pos; i--) {
24591  entries[i] = entries[i-1];
24592  }
24593  entries[pos].code_line = code_line;
24594  entries[pos].code_object = code_object;
24595  __pyx_code_cache.count++;
24596  Py_INCREF(code_object);
24597 }
24598 
24599 #include "compile.h"
24600 #include "frameobject.h"
24601 #include "traceback.h"
24602 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
24603  const char *funcname, int c_line,
24604  int py_line, const char *filename) {
24605  PyCodeObject *py_code = 0;
24606  PyObject *py_srcfile = 0;
24607  PyObject *py_funcname = 0;
24608  #if PY_MAJOR_VERSION < 3
24609  py_srcfile = PyString_FromString(filename);
24610  #else
24611  py_srcfile = PyUnicode_FromString(filename);
24612  #endif
24613  if (!py_srcfile) goto bad;
24614  if (c_line) {
24615  #if PY_MAJOR_VERSION < 3
24616  py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
24617  #else
24618  py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
24619  #endif
24620  }
24621  else {
24622  #if PY_MAJOR_VERSION < 3
24623  py_funcname = PyString_FromString(funcname);
24624  #else
24625  py_funcname = PyUnicode_FromString(funcname);
24626  #endif
24627  }
24628  if (!py_funcname) goto bad;
24629  py_code = __Pyx_PyCode_New(
24630  0,
24631  0,
24632  0,
24633  0,
24634  0,
24635  __pyx_empty_bytes, /*PyObject *code,*/
24636  __pyx_empty_tuple, /*PyObject *consts,*/
24637  __pyx_empty_tuple, /*PyObject *names,*/
24638  __pyx_empty_tuple, /*PyObject *varnames,*/
24639  __pyx_empty_tuple, /*PyObject *freevars,*/
24640  __pyx_empty_tuple, /*PyObject *cellvars,*/
24641  py_srcfile, /*PyObject *filename,*/
24642  py_funcname, /*PyObject *name,*/
24643  py_line,
24644  __pyx_empty_bytes /*PyObject *lnotab*/
24645  );
24646  Py_DECREF(py_srcfile);
24647  Py_DECREF(py_funcname);
24648  return py_code;
24649 bad:
24650  Py_XDECREF(py_srcfile);
24651  Py_XDECREF(py_funcname);
24652  return NULL;
24653 }
24654 static void __Pyx_AddTraceback(const char *funcname, int c_line,
24655  int py_line, const char *filename) {
24656  PyCodeObject *py_code = 0;
24657  PyFrameObject *py_frame = 0;
24658  py_code = __pyx_find_code_object(c_line ? c_line : py_line);
24659  if (!py_code) {
24660  py_code = __Pyx_CreateCodeObjectForTraceback(
24661  funcname, c_line, py_line, filename);
24662  if (!py_code) goto bad;
24663  __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
24664  }
24665  py_frame = PyFrame_New(
24666  PyThreadState_GET(), /*PyThreadState *tstate,*/
24667  py_code, /*PyCodeObject *code,*/
24668  __pyx_d, /*PyObject *globals,*/
24669  0 /*PyObject *locals*/
24670  );
24671  if (!py_frame) goto bad;
24672  py_frame->f_lineno = py_line;
24673  PyTraceBack_Here(py_frame);
24674 bad:
24675  Py_XDECREF(py_code);
24676  Py_XDECREF(py_frame);
24677 }
24678 
24679 #if PY_MAJOR_VERSION < 3
24680 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
24681  if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
24682  if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
24683  PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
24684  return -1;
24685 }
24686 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
24687  PyObject *obj = view->obj;
24688  if (!obj) return;
24689  if (PyObject_CheckBuffer(obj)) {
24690  PyBuffer_Release(view);
24691  return;
24692  }
24693  if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; }
24694  Py_DECREF(obj);
24695  view->obj = NULL;
24696 }
24697 #endif
24698 
24699 
24700  #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
24701  __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
24702 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
24703  __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
24704 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
24705  {\
24706  func_type value = func_value;\
24707  if (sizeof(target_type) < sizeof(func_type)) {\
24708  if (unlikely(value != (func_type) (target_type) value)) {\
24709  func_type zero = 0;\
24710  if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
24711  return (target_type) -1;\
24712  if (is_unsigned && unlikely(value < zero))\
24713  goto raise_neg_overflow;\
24714  else\
24715  goto raise_overflow;\
24716  }\
24717  }\
24718  return (target_type) value;\
24719  }
24720 
24721 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
24722  const int neg_one = (int) -1, const_zero = (int) 0;
24723  const int is_unsigned = neg_one > const_zero;
24724 #if PY_MAJOR_VERSION < 3
24725  if (likely(PyInt_Check(x))) {
24726  if (sizeof(int) < sizeof(long)) {
24727  __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
24728  } else {
24729  long val = PyInt_AS_LONG(x);
24730  if (is_unsigned && unlikely(val < 0)) {
24731  goto raise_neg_overflow;
24732  }
24733  return (int) val;
24734  }
24735  } else
24736 #endif
24737  if (likely(PyLong_Check(x))) {
24738  if (is_unsigned) {
24739 #if CYTHON_USE_PYLONG_INTERNALS
24740  const digit* digits = ((PyLongObject*)x)->ob_digit;
24741  switch (Py_SIZE(x)) {
24742  case 0: return (int) 0;
24743  case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
24744  case 2:
24745  if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
24746  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
24747  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24748  } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
24749  return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
24750  }
24751  }
24752  break;
24753  case 3:
24754  if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
24755  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
24756  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24757  } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
24758  return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
24759  }
24760  }
24761  break;
24762  case 4:
24763  if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
24764  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
24765  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24766  } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
24767  return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
24768  }
24769  }
24770  break;
24771  }
24772 #endif
24773 #if CYTHON_COMPILING_IN_CPYTHON
24774  if (unlikely(Py_SIZE(x) < 0)) {
24775  goto raise_neg_overflow;
24776  }
24777 #else
24778  {
24779  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
24780  if (unlikely(result < 0))
24781  return (int) -1;
24782  if (unlikely(result == 1))
24783  goto raise_neg_overflow;
24784  }
24785 #endif
24786  if (sizeof(int) <= sizeof(unsigned long)) {
24787  __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
24788  } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
24789  __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
24790  }
24791  } else {
24792 #if CYTHON_USE_PYLONG_INTERNALS
24793  const digit* digits = ((PyLongObject*)x)->ob_digit;
24794  switch (Py_SIZE(x)) {
24795  case 0: return (int) 0;
24796  case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) digits[0])
24797  case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
24798  case -2:
24799  if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
24800  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
24801  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24802  } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
24803  return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
24804  }
24805  }
24806  break;
24807  case 2:
24808  if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
24809  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
24810  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24811  } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
24812  return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
24813  }
24814  }
24815  break;
24816  case -3:
24817  if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
24818  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
24819  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24820  } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
24821  return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
24822  }
24823  }
24824  break;
24825  case 3:
24826  if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
24827  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
24828  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24829  } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
24830  return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
24831  }
24832  }
24833  break;
24834  case -4:
24835  if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
24836  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
24837  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24838  } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
24839  return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
24840  }
24841  }
24842  break;
24843  case 4:
24844  if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
24845  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
24846  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24847  } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
24848  return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
24849  }
24850  }
24851  break;
24852  }
24853 #endif
24854  if (sizeof(int) <= sizeof(long)) {
24855  __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
24856  } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
24857  __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
24858  }
24859  }
24860  {
24861 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
24862  PyErr_SetString(PyExc_RuntimeError,
24863  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
24864 #else
24865  int val;
24866  PyObject *v = __Pyx_PyNumber_Int(x);
24867  #if PY_MAJOR_VERSION < 3
24868  if (likely(v) && !PyLong_Check(v)) {
24869  PyObject *tmp = v;
24870  v = PyNumber_Long(tmp);
24871  Py_DECREF(tmp);
24872  }
24873  #endif
24874  if (likely(v)) {
24875  int one = 1; int is_little = (int)*(unsigned char *)&one;
24876  unsigned char *bytes = (unsigned char *)&val;
24877  int ret = _PyLong_AsByteArray((PyLongObject *)v,
24878  bytes, sizeof(val),
24879  is_little, !is_unsigned);
24880  Py_DECREF(v);
24881  if (likely(!ret))
24882  return val;
24883  }
24884 #endif
24885  return (int) -1;
24886  }
24887  } else {
24888  int val;
24889  PyObject *tmp = __Pyx_PyNumber_Int(x);
24890  if (!tmp) return (int) -1;
24891  val = __Pyx_PyInt_As_int(tmp);
24892  Py_DECREF(tmp);
24893  return val;
24894  }
24895 raise_overflow:
24896  PyErr_SetString(PyExc_OverflowError,
24897  "value too large to convert to int");
24898  return (int) -1;
24899 raise_neg_overflow:
24900  PyErr_SetString(PyExc_OverflowError,
24901  "can't convert negative value to int");
24902  return (int) -1;
24903 }
24904 
24905 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
24906  const int neg_one = (int) -1, const_zero = (int) 0;
24907  const int is_unsigned = neg_one > const_zero;
24908  if (is_unsigned) {
24909  if (sizeof(int) < sizeof(long)) {
24910  return PyInt_FromLong((long) value);
24911  } else if (sizeof(int) <= sizeof(unsigned long)) {
24912  return PyLong_FromUnsignedLong((unsigned long) value);
24913  } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
24914  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
24915  }
24916  } else {
24917  if (sizeof(int) <= sizeof(long)) {
24918  return PyInt_FromLong((long) value);
24919  } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
24920  return PyLong_FromLongLong((PY_LONG_LONG) value);
24921  }
24922  }
24923  {
24924  int one = 1; int little = (int)*(unsigned char *)&one;
24925  unsigned char *bytes = (unsigned char *)&value;
24926  return _PyLong_FromByteArray(bytes, sizeof(int),
24927  little, !is_unsigned);
24928  }
24929 }
24930 
24931 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value) {
24932  const Py_intptr_t neg_one = (Py_intptr_t) -1, const_zero = (Py_intptr_t) 0;
24933  const int is_unsigned = neg_one > const_zero;
24934  if (is_unsigned) {
24935  if (sizeof(Py_intptr_t) < sizeof(long)) {
24936  return PyInt_FromLong((long) value);
24937  } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) {
24938  return PyLong_FromUnsignedLong((unsigned long) value);
24939  } else if (sizeof(Py_intptr_t) <= sizeof(unsigned PY_LONG_LONG)) {
24940  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
24941  }
24942  } else {
24943  if (sizeof(Py_intptr_t) <= sizeof(long)) {
24944  return PyInt_FromLong((long) value);
24945  } else if (sizeof(Py_intptr_t) <= sizeof(PY_LONG_LONG)) {
24946  return PyLong_FromLongLong((PY_LONG_LONG) value);
24947  }
24948  }
24949  {
24950  int one = 1; int little = (int)*(unsigned char *)&one;
24951  unsigned char *bytes = (unsigned char *)&value;
24952  return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t),
24953  little, !is_unsigned);
24954  }
24955 }
24956 
24957 static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_As_Py_intptr_t(PyObject *x) {
24958  const Py_intptr_t neg_one = (Py_intptr_t) -1, const_zero = (Py_intptr_t) 0;
24959  const int is_unsigned = neg_one > const_zero;
24960 #if PY_MAJOR_VERSION < 3
24961  if (likely(PyInt_Check(x))) {
24962  if (sizeof(Py_intptr_t) < sizeof(long)) {
24963  __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, PyInt_AS_LONG(x))
24964  } else {
24965  long val = PyInt_AS_LONG(x);
24966  if (is_unsigned && unlikely(val < 0)) {
24967  goto raise_neg_overflow;
24968  }
24969  return (Py_intptr_t) val;
24970  }
24971  } else
24972 #endif
24973  if (likely(PyLong_Check(x))) {
24974  if (is_unsigned) {
24975 #if CYTHON_USE_PYLONG_INTERNALS
24976  const digit* digits = ((PyLongObject*)x)->ob_digit;
24977  switch (Py_SIZE(x)) {
24978  case 0: return (Py_intptr_t) 0;
24979  case 1: __PYX_VERIFY_RETURN_INT(Py_intptr_t, digit, digits[0])
24980  case 2:
24981  if (8 * sizeof(Py_intptr_t) > 1 * PyLong_SHIFT) {
24982  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
24983  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24984  } else if (8 * sizeof(Py_intptr_t) >= 2 * PyLong_SHIFT) {
24985  return (Py_intptr_t) (((((Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]));
24986  }
24987  }
24988  break;
24989  case 3:
24990  if (8 * sizeof(Py_intptr_t) > 2 * PyLong_SHIFT) {
24991  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
24992  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24993  } else if (8 * sizeof(Py_intptr_t) >= 3 * PyLong_SHIFT) {
24994  return (Py_intptr_t) (((((((Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]));
24995  }
24996  }
24997  break;
24998  case 4:
24999  if (8 * sizeof(Py_intptr_t) > 3 * PyLong_SHIFT) {
25000  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25001  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25002  } else if (8 * sizeof(Py_intptr_t) >= 4 * PyLong_SHIFT) {
25003  return (Py_intptr_t) (((((((((Py_intptr_t)digits[3]) << PyLong_SHIFT) | (Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]));
25004  }
25005  }
25006  break;
25007  }
25008 #endif
25009 #if CYTHON_COMPILING_IN_CPYTHON
25010  if (unlikely(Py_SIZE(x) < 0)) {
25011  goto raise_neg_overflow;
25012  }
25013 #else
25014  {
25015  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
25016  if (unlikely(result < 0))
25017  return (Py_intptr_t) -1;
25018  if (unlikely(result == 1))
25019  goto raise_neg_overflow;
25020  }
25021 #endif
25022  if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) {
25023  __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, unsigned long, PyLong_AsUnsignedLong(x))
25024  } else if (sizeof(Py_intptr_t) <= sizeof(unsigned PY_LONG_LONG)) {
25025  __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
25026  }
25027  } else {
25028 #if CYTHON_USE_PYLONG_INTERNALS
25029  const digit* digits = ((PyLongObject*)x)->ob_digit;
25030  switch (Py_SIZE(x)) {
25031  case 0: return (Py_intptr_t) 0;
25032  case -1: __PYX_VERIFY_RETURN_INT(Py_intptr_t, sdigit, -(sdigit) digits[0])
25033  case 1: __PYX_VERIFY_RETURN_INT(Py_intptr_t, digit, +digits[0])
25034  case -2:
25035  if (8 * sizeof(Py_intptr_t) - 1 > 1 * PyLong_SHIFT) {
25036  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25037  __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25038  } else if (8 * sizeof(Py_intptr_t) - 1 > 2 * PyLong_SHIFT) {
25039  return (Py_intptr_t) (((Py_intptr_t)-1)*(((((Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
25040  }
25041  }
25042  break;
25043  case 2:
25044  if (8 * sizeof(Py_intptr_t) > 1 * PyLong_SHIFT) {
25045  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25046  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25047  } else if (8 * sizeof(Py_intptr_t) - 1 > 2 * PyLong_SHIFT) {
25048  return (Py_intptr_t) ((((((Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
25049  }
25050  }
25051  break;
25052  case -3:
25053  if (8 * sizeof(Py_intptr_t) - 1 > 2 * PyLong_SHIFT) {
25054  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25055  __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25056  } else if (8 * sizeof(Py_intptr_t) - 1 > 3 * PyLong_SHIFT) {
25057  return (Py_intptr_t) (((Py_intptr_t)-1)*(((((((Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
25058  }
25059  }
25060  break;
25061  case 3:
25062  if (8 * sizeof(Py_intptr_t) > 2 * PyLong_SHIFT) {
25063  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25064  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25065  } else if (8 * sizeof(Py_intptr_t) - 1 > 3 * PyLong_SHIFT) {
25066  return (Py_intptr_t) ((((((((Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
25067  }
25068  }
25069  break;
25070  case -4:
25071  if (8 * sizeof(Py_intptr_t) - 1 > 3 * PyLong_SHIFT) {
25072  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25073  __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25074  } else if (8 * sizeof(Py_intptr_t) - 1 > 4 * PyLong_SHIFT) {
25075  return (Py_intptr_t) (((Py_intptr_t)-1)*(((((((((Py_intptr_t)digits[3]) << PyLong_SHIFT) | (Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
25076  }
25077  }
25078  break;
25079  case 4:
25080  if (8 * sizeof(Py_intptr_t) > 3 * PyLong_SHIFT) {
25081  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25082  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25083  } else if (8 * sizeof(Py_intptr_t) - 1 > 4 * PyLong_SHIFT) {
25084  return (Py_intptr_t) ((((((((((Py_intptr_t)digits[3]) << PyLong_SHIFT) | (Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
25085  }
25086  }
25087  break;
25088  }
25089 #endif
25090  if (sizeof(Py_intptr_t) <= sizeof(long)) {
25091  __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, long, PyLong_AsLong(x))
25092  } else if (sizeof(Py_intptr_t) <= sizeof(PY_LONG_LONG)) {
25093  __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, PY_LONG_LONG, PyLong_AsLongLong(x))
25094  }
25095  }
25096  {
25097 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
25098  PyErr_SetString(PyExc_RuntimeError,
25099  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
25100 #else
25101  Py_intptr_t val;
25102  PyObject *v = __Pyx_PyNumber_Int(x);
25103  #if PY_MAJOR_VERSION < 3
25104  if (likely(v) && !PyLong_Check(v)) {
25105  PyObject *tmp = v;
25106  v = PyNumber_Long(tmp);
25107  Py_DECREF(tmp);
25108  }
25109  #endif
25110  if (likely(v)) {
25111  int one = 1; int is_little = (int)*(unsigned char *)&one;
25112  unsigned char *bytes = (unsigned char *)&val;
25113  int ret = _PyLong_AsByteArray((PyLongObject *)v,
25114  bytes, sizeof(val),
25115  is_little, !is_unsigned);
25116  Py_DECREF(v);
25117  if (likely(!ret))
25118  return val;
25119  }
25120 #endif
25121  return (Py_intptr_t) -1;
25122  }
25123  } else {
25124  Py_intptr_t val;
25125  PyObject *tmp = __Pyx_PyNumber_Int(x);
25126  if (!tmp) return (Py_intptr_t) -1;
25127  val = __Pyx_PyInt_As_Py_intptr_t(tmp);
25128  Py_DECREF(tmp);
25129  return val;
25130  }
25131 raise_overflow:
25132  PyErr_SetString(PyExc_OverflowError,
25133  "value too large to convert to Py_intptr_t");
25134  return (Py_intptr_t) -1;
25135 raise_neg_overflow:
25136  PyErr_SetString(PyExc_OverflowError,
25137  "can't convert negative value to Py_intptr_t");
25138  return (Py_intptr_t) -1;
25139 }
25140 
25141 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
25142  const long neg_one = (long) -1, const_zero = (long) 0;
25143  const int is_unsigned = neg_one > const_zero;
25144  if (is_unsigned) {
25145  if (sizeof(long) < sizeof(long)) {
25146  return PyInt_FromLong((long) value);
25147  } else if (sizeof(long) <= sizeof(unsigned long)) {
25148  return PyLong_FromUnsignedLong((unsigned long) value);
25149  } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
25150  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
25151  }
25152  } else {
25153  if (sizeof(long) <= sizeof(long)) {
25154  return PyInt_FromLong((long) value);
25155  } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
25156  return PyLong_FromLongLong((PY_LONG_LONG) value);
25157  }
25158  }
25159  {
25160  int one = 1; int little = (int)*(unsigned char *)&one;
25161  unsigned char *bytes = (unsigned char *)&value;
25162  return _PyLong_FromByteArray(bytes, sizeof(long),
25163  little, !is_unsigned);
25164  }
25165 }
25166 
25167 #if CYTHON_CCOMPLEX
25168  #ifdef __cplusplus
25169  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
25170  return ::std::complex< float >(x, y);
25171  }
25172  #else
25173  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
25174  return x + y*(__pyx_t_float_complex)_Complex_I;
25175  }
25176  #endif
25177 #else
25178  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
25179  __pyx_t_float_complex z;
25180  z.real = x;
25181  z.imag = y;
25182  return z;
25183  }
25184 #endif
25185 
25186 #if CYTHON_CCOMPLEX
25187 #else
25188  static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25189  return (a.real == b.real) && (a.imag == b.imag);
25190  }
25191  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25192  __pyx_t_float_complex z;
25193  z.real = a.real + b.real;
25194  z.imag = a.imag + b.imag;
25195  return z;
25196  }
25197  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25198  __pyx_t_float_complex z;
25199  z.real = a.real - b.real;
25200  z.imag = a.imag - b.imag;
25201  return z;
25202  }
25203  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25204  __pyx_t_float_complex z;
25205  z.real = a.real * b.real - a.imag * b.imag;
25206  z.imag = a.real * b.imag + a.imag * b.real;
25207  return z;
25208  }
25209  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25210  __pyx_t_float_complex z;
25211  float denom = b.real * b.real + b.imag * b.imag;
25212  z.real = (a.real * b.real + a.imag * b.imag) / denom;
25213  z.imag = (a.imag * b.real - a.real * b.imag) / denom;
25214  return z;
25215  }
25216  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) {
25217  __pyx_t_float_complex z;
25218  z.real = -a.real;
25219  z.imag = -a.imag;
25220  return z;
25221  }
25222  static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) {
25223  return (a.real == 0) && (a.imag == 0);
25224  }
25225  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) {
25226  __pyx_t_float_complex z;
25227  z.real = a.real;
25228  z.imag = -a.imag;
25229  return z;
25230  }
25231  #if 1
25232  static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) {
25233  #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
25234  return sqrtf(z.real*z.real + z.imag*z.imag);
25235  #else
25236  return hypotf(z.real, z.imag);
25237  #endif
25238  }
25239  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25240  __pyx_t_float_complex z;
25241  float r, lnr, theta, z_r, z_theta;
25242  if (b.imag == 0 && b.real == (int)b.real) {
25243  if (b.real < 0) {
25244  float denom = a.real * a.real + a.imag * a.imag;
25245  a.real = a.real / denom;
25246  a.imag = -a.imag / denom;
25247  b.real = -b.real;
25248  }
25249  switch ((int)b.real) {
25250  case 0:
25251  z.real = 1;
25252  z.imag = 0;
25253  return z;
25254  case 1:
25255  return a;
25256  case 2:
25257  z = __Pyx_c_prodf(a, a);
25258  return __Pyx_c_prodf(a, a);
25259  case 3:
25260  z = __Pyx_c_prodf(a, a);
25261  return __Pyx_c_prodf(z, a);
25262  case 4:
25263  z = __Pyx_c_prodf(a, a);
25264  return __Pyx_c_prodf(z, z);
25265  }
25266  }
25267  if (a.imag == 0) {
25268  if (a.real == 0) {
25269  return a;
25270  }
25271  r = a.real;
25272  theta = 0;
25273  } else {
25274  r = __Pyx_c_absf(a);
25275  theta = atan2f(a.imag, a.real);
25276  }
25277  lnr = logf(r);
25278  z_r = expf(lnr * b.real - theta * b.imag);
25279  z_theta = theta * b.real + lnr * b.imag;
25280  z.real = z_r * cosf(z_theta);
25281  z.imag = z_r * sinf(z_theta);
25282  return z;
25283  }
25284  #endif
25285 #endif
25286 
25287 #if CYTHON_CCOMPLEX
25288  #ifdef __cplusplus
25289  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
25290  return ::std::complex< double >(x, y);
25291  }
25292  #else
25293  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
25294  return x + y*(__pyx_t_double_complex)_Complex_I;
25295  }
25296  #endif
25297 #else
25298  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
25299  __pyx_t_double_complex z;
25300  z.real = x;
25301  z.imag = y;
25302  return z;
25303  }
25304 #endif
25305 
25306 #if CYTHON_CCOMPLEX
25307 #else
25308  static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25309  return (a.real == b.real) && (a.imag == b.imag);
25310  }
25311  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25312  __pyx_t_double_complex z;
25313  z.real = a.real + b.real;
25314  z.imag = a.imag + b.imag;
25315  return z;
25316  }
25317  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25318  __pyx_t_double_complex z;
25319  z.real = a.real - b.real;
25320  z.imag = a.imag - b.imag;
25321  return z;
25322  }
25323  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25324  __pyx_t_double_complex z;
25325  z.real = a.real * b.real - a.imag * b.imag;
25326  z.imag = a.real * b.imag + a.imag * b.real;
25327  return z;
25328  }
25329  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25330  __pyx_t_double_complex z;
25331  double denom = b.real * b.real + b.imag * b.imag;
25332  z.real = (a.real * b.real + a.imag * b.imag) / denom;
25333  z.imag = (a.imag * b.real - a.real * b.imag) / denom;
25334  return z;
25335  }
25336  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) {
25337  __pyx_t_double_complex z;
25338  z.real = -a.real;
25339  z.imag = -a.imag;
25340  return z;
25341  }
25342  static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) {
25343  return (a.real == 0) && (a.imag == 0);
25344  }
25345  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) {
25346  __pyx_t_double_complex z;
25347  z.real = a.real;
25348  z.imag = -a.imag;
25349  return z;
25350  }
25351  #if 1
25352  static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) {
25353  #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
25354  return sqrt(z.real*z.real + z.imag*z.imag);
25355  #else
25356  return hypot(z.real, z.imag);
25357  #endif
25358  }
25359  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25360  __pyx_t_double_complex z;
25361  double r, lnr, theta, z_r, z_theta;
25362  if (b.imag == 0 && b.real == (int)b.real) {
25363  if (b.real < 0) {
25364  double denom = a.real * a.real + a.imag * a.imag;
25365  a.real = a.real / denom;
25366  a.imag = -a.imag / denom;
25367  b.real = -b.real;
25368  }
25369  switch ((int)b.real) {
25370  case 0:
25371  z.real = 1;
25372  z.imag = 0;
25373  return z;
25374  case 1:
25375  return a;
25376  case 2:
25377  z = __Pyx_c_prod(a, a);
25378  return __Pyx_c_prod(a, a);
25379  case 3:
25380  z = __Pyx_c_prod(a, a);
25381  return __Pyx_c_prod(z, a);
25382  case 4:
25383  z = __Pyx_c_prod(a, a);
25384  return __Pyx_c_prod(z, z);
25385  }
25386  }
25387  if (a.imag == 0) {
25388  if (a.real == 0) {
25389  return a;
25390  }
25391  r = a.real;
25392  theta = 0;
25393  } else {
25394  r = __Pyx_c_abs(a);
25395  theta = atan2(a.imag, a.real);
25396  }
25397  lnr = log(r);
25398  z_r = exp(lnr * b.real - theta * b.imag);
25399  z_theta = theta * b.real + lnr * b.imag;
25400  z.real = z_r * cos(z_theta);
25401  z.imag = z_r * sin(z_theta);
25402  return z;
25403  }
25404  #endif
25405 #endif
25406 
25407 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) {
25408  const enum NPY_TYPES neg_one = (enum NPY_TYPES) -1, const_zero = (enum NPY_TYPES) 0;
25409  const int is_unsigned = neg_one > const_zero;
25410  if (is_unsigned) {
25411  if (sizeof(enum NPY_TYPES) < sizeof(long)) {
25412  return PyInt_FromLong((long) value);
25413  } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) {
25414  return PyLong_FromUnsignedLong((unsigned long) value);
25415  } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) {
25416  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
25417  }
25418  } else {
25419  if (sizeof(enum NPY_TYPES) <= sizeof(long)) {
25420  return PyInt_FromLong((long) value);
25421  } else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) {
25422  return PyLong_FromLongLong((PY_LONG_LONG) value);
25423  }
25424  }
25425  {
25426  int one = 1; int little = (int)*(unsigned char *)&one;
25427  unsigned char *bytes = (unsigned char *)&value;
25428  return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES),
25429  little, !is_unsigned);
25430  }
25431 }
25432 
25433 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
25434  const long neg_one = (long) -1, const_zero = (long) 0;
25435  const int is_unsigned = neg_one > const_zero;
25436 #if PY_MAJOR_VERSION < 3
25437  if (likely(PyInt_Check(x))) {
25438  if (sizeof(long) < sizeof(long)) {
25439  __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
25440  } else {
25441  long val = PyInt_AS_LONG(x);
25442  if (is_unsigned && unlikely(val < 0)) {
25443  goto raise_neg_overflow;
25444  }
25445  return (long) val;
25446  }
25447  } else
25448 #endif
25449  if (likely(PyLong_Check(x))) {
25450  if (is_unsigned) {
25451 #if CYTHON_USE_PYLONG_INTERNALS
25452  const digit* digits = ((PyLongObject*)x)->ob_digit;
25453  switch (Py_SIZE(x)) {
25454  case 0: return (long) 0;
25455  case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
25456  case 2:
25457  if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
25458  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25459  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25460  } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
25461  return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
25462  }
25463  }
25464  break;
25465  case 3:
25466  if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
25467  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25468  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25469  } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
25470  return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
25471  }
25472  }
25473  break;
25474  case 4:
25475  if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
25476  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25477  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25478  } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
25479  return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
25480  }
25481  }
25482  break;
25483  }
25484 #endif
25485 #if CYTHON_COMPILING_IN_CPYTHON
25486  if (unlikely(Py_SIZE(x) < 0)) {
25487  goto raise_neg_overflow;
25488  }
25489 #else
25490  {
25491  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
25492  if (unlikely(result < 0))
25493  return (long) -1;
25494  if (unlikely(result == 1))
25495  goto raise_neg_overflow;
25496  }
25497 #endif
25498  if (sizeof(long) <= sizeof(unsigned long)) {
25499  __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
25500  } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
25501  __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
25502  }
25503  } else {
25504 #if CYTHON_USE_PYLONG_INTERNALS
25505  const digit* digits = ((PyLongObject*)x)->ob_digit;
25506  switch (Py_SIZE(x)) {
25507  case 0: return (long) 0;
25508  case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) digits[0])
25509  case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
25510  case -2:
25511  if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
25512  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25513  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25514  } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
25515  return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
25516  }
25517  }
25518  break;
25519  case 2:
25520  if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
25521  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25522  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25523  } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
25524  return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
25525  }
25526  }
25527  break;
25528  case -3:
25529  if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
25530  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25531  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25532  } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
25533  return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
25534  }
25535  }
25536  break;
25537  case 3:
25538  if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
25539  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25540  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25541  } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
25542  return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
25543  }
25544  }
25545  break;
25546  case -4:
25547  if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
25548  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25549  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25550  } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
25551  return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
25552  }
25553  }
25554  break;
25555  case 4:
25556  if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
25557  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25558  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25559  } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
25560  return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
25561  }
25562  }
25563  break;
25564  }
25565 #endif
25566  if (sizeof(long) <= sizeof(long)) {
25567  __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
25568  } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
25569  __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
25570  }
25571  }
25572  {
25573 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
25574  PyErr_SetString(PyExc_RuntimeError,
25575  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
25576 #else
25577  long val;
25578  PyObject *v = __Pyx_PyNumber_Int(x);
25579  #if PY_MAJOR_VERSION < 3
25580  if (likely(v) && !PyLong_Check(v)) {
25581  PyObject *tmp = v;
25582  v = PyNumber_Long(tmp);
25583  Py_DECREF(tmp);
25584  }
25585  #endif
25586  if (likely(v)) {
25587  int one = 1; int is_little = (int)*(unsigned char *)&one;
25588  unsigned char *bytes = (unsigned char *)&val;
25589  int ret = _PyLong_AsByteArray((PyLongObject *)v,
25590  bytes, sizeof(val),
25591  is_little, !is_unsigned);
25592  Py_DECREF(v);
25593  if (likely(!ret))
25594  return val;
25595  }
25596 #endif
25597  return (long) -1;
25598  }
25599  } else {
25600  long val;
25601  PyObject *tmp = __Pyx_PyNumber_Int(x);
25602  if (!tmp) return (long) -1;
25603  val = __Pyx_PyInt_As_long(tmp);
25604  Py_DECREF(tmp);
25605  return val;
25606  }
25607 raise_overflow:
25608  PyErr_SetString(PyExc_OverflowError,
25609  "value too large to convert to long");
25610  return (long) -1;
25611 raise_neg_overflow:
25612  PyErr_SetString(PyExc_OverflowError,
25613  "can't convert negative value to long");
25614  return (long) -1;
25615 }
25616 
25617 static int __Pyx_check_binary_version(void) {
25618  char ctversion[4], rtversion[4];
25619  PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
25620  PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
25621  if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
25622  char message[200];
25623  PyOS_snprintf(message, sizeof(message),
25624  "compiletime version %s of module '%.100s' "
25625  "does not match runtime version %s",
25626  ctversion, __Pyx_MODULE_NAME, rtversion);
25627  return PyErr_WarnEx(NULL, message, 1);
25628  }
25629  return 0;
25630 }
25631 
25632 #ifndef __PYX_HAVE_RT_ImportModule
25633 #define __PYX_HAVE_RT_ImportModule
25634 static PyObject *__Pyx_ImportModule(const char *name) {
25635  PyObject *py_name = 0;
25636  PyObject *py_module = 0;
25637  py_name = __Pyx_PyIdentifier_FromString(name);
25638  if (!py_name)
25639  goto bad;
25640  py_module = PyImport_Import(py_name);
25641  Py_DECREF(py_name);
25642  return py_module;
25643 bad:
25644  Py_XDECREF(py_name);
25645  return 0;
25646 }
25647 #endif
25648 
25649 #ifndef __PYX_HAVE_RT_ImportType
25650 #define __PYX_HAVE_RT_ImportType
25651 static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
25652  size_t size, int strict)
25653 {
25654  PyObject *py_module = 0;
25655  PyObject *result = 0;
25656  PyObject *py_name = 0;
25657  char warning[200];
25658  Py_ssize_t basicsize;
25659 #ifdef Py_LIMITED_API
25660  PyObject *py_basicsize;
25661 #endif
25662  py_module = __Pyx_ImportModule(module_name);
25663  if (!py_module)
25664  goto bad;
25665  py_name = __Pyx_PyIdentifier_FromString(class_name);
25666  if (!py_name)
25667  goto bad;
25668  result = PyObject_GetAttr(py_module, py_name);
25669  Py_DECREF(py_name);
25670  py_name = 0;
25671  Py_DECREF(py_module);
25672  py_module = 0;
25673  if (!result)
25674  goto bad;
25675  if (!PyType_Check(result)) {
25676  PyErr_Format(PyExc_TypeError,
25677  "%.200s.%.200s is not a type object",
25678  module_name, class_name);
25679  goto bad;
25680  }
25681 #ifndef Py_LIMITED_API
25682  basicsize = ((PyTypeObject *)result)->tp_basicsize;
25683 #else
25684  py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
25685  if (!py_basicsize)
25686  goto bad;
25687  basicsize = PyLong_AsSsize_t(py_basicsize);
25688  Py_DECREF(py_basicsize);
25689  py_basicsize = 0;
25690  if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
25691  goto bad;
25692 #endif
25693  if (!strict && (size_t)basicsize > size) {
25694  PyOS_snprintf(warning, sizeof(warning),
25695  "%s.%s size changed, may indicate binary incompatibility",
25696  module_name, class_name);
25697  if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
25698  }
25699  else if ((size_t)basicsize != size) {
25700  PyErr_Format(PyExc_ValueError,
25701  "%.200s.%.200s has the wrong size, try recompiling",
25702  module_name, class_name);
25703  goto bad;
25704  }
25705  return (PyTypeObject *)result;
25706 bad:
25707  Py_XDECREF(py_module);
25708  Py_XDECREF(result);
25709  return NULL;
25710 }
25711 #endif
25712 
25713 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
25714  while (t->p) {
25715  #if PY_MAJOR_VERSION < 3
25716  if (t->is_unicode) {
25717  *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
25718  } else if (t->intern) {
25719  *t->p = PyString_InternFromString(t->s);
25720  } else {
25721  *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
25722  }
25723  #else
25724  if (t->is_unicode | t->is_str) {
25725  if (t->intern) {
25726  *t->p = PyUnicode_InternFromString(t->s);
25727  } else if (t->encoding) {
25728  *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
25729  } else {
25730  *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
25731  }
25732  } else {
25733  *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
25734  }
25735  #endif
25736  if (!*t->p)
25737  return -1;
25738  ++t;
25739  }
25740  return 0;
25741 }
25742 
25743 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
25744  return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
25745 }
25746 static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
25747  Py_ssize_t ignore;
25748  return __Pyx_PyObject_AsStringAndSize(o, &ignore);
25749 }
25750 static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
25751 #if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
25752  if (
25753 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
25754  __Pyx_sys_getdefaultencoding_not_ascii &&
25755 #endif
25756  PyUnicode_Check(o)) {
25757 #if PY_VERSION_HEX < 0x03030000
25758  char* defenc_c;
25759  PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
25760  if (!defenc) return NULL;
25761  defenc_c = PyBytes_AS_STRING(defenc);
25762 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
25763  {
25764  char* end = defenc_c + PyBytes_GET_SIZE(defenc);
25765  char* c;
25766  for (c = defenc_c; c < end; c++) {
25767  if ((unsigned char) (*c) >= 128) {
25768  PyUnicode_AsASCIIString(o);
25769  return NULL;
25770  }
25771  }
25772  }
25773 #endif
25774  *length = PyBytes_GET_SIZE(defenc);
25775  return defenc_c;
25776 #else
25777  if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
25778 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
25779  if (PyUnicode_IS_ASCII(o)) {
25780  *length = PyUnicode_GET_LENGTH(o);
25781  return PyUnicode_AsUTF8(o);
25782  } else {
25783  PyUnicode_AsASCIIString(o);
25784  return NULL;
25785  }
25786 #else
25787  return PyUnicode_AsUTF8AndSize(o, length);
25788 #endif
25789 #endif
25790  } else
25791 #endif
25792 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
25793  if (PyByteArray_Check(o)) {
25794  *length = PyByteArray_GET_SIZE(o);
25795  return PyByteArray_AS_STRING(o);
25796  } else
25797 #endif
25798  {
25799  char* result;
25800  int r = PyBytes_AsStringAndSize(o, &result, length);
25801  if (unlikely(r < 0)) {
25802  return NULL;
25803  } else {
25804  return result;
25805  }
25806  }
25807 }
25808 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
25809  int is_true = x == Py_True;
25810  if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
25811  else return PyObject_IsTrue(x);
25812 }
25813 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
25814  PyNumberMethods *m;
25815  const char *name = NULL;
25816  PyObject *res = NULL;
25817 #if PY_MAJOR_VERSION < 3
25818  if (PyInt_Check(x) || PyLong_Check(x))
25819 #else
25820  if (PyLong_Check(x))
25821 #endif
25822  return __Pyx_NewRef(x);
25823  m = Py_TYPE(x)->tp_as_number;
25824 #if PY_MAJOR_VERSION < 3
25825  if (m && m->nb_int) {
25826  name = "int";
25827  res = PyNumber_Int(x);
25828  }
25829  else if (m && m->nb_long) {
25830  name = "long";
25831  res = PyNumber_Long(x);
25832  }
25833 #else
25834  if (m && m->nb_int) {
25835  name = "int";
25836  res = PyNumber_Long(x);
25837  }
25838 #endif
25839  if (res) {
25840 #if PY_MAJOR_VERSION < 3
25841  if (!PyInt_Check(res) && !PyLong_Check(res)) {
25842 #else
25843  if (!PyLong_Check(res)) {
25844 #endif
25845  PyErr_Format(PyExc_TypeError,
25846  "__%.4s__ returned non-%.4s (type %.200s)",
25847  name, name, Py_TYPE(res)->tp_name);
25848  Py_DECREF(res);
25849  return NULL;
25850  }
25851  }
25852  else if (!PyErr_Occurred()) {
25853  PyErr_SetString(PyExc_TypeError,
25854  "an integer is required");
25855  }
25856  return res;
25857 }
25858 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
25859  Py_ssize_t ival;
25860  PyObject *x;
25861 #if PY_MAJOR_VERSION < 3
25862  if (likely(PyInt_CheckExact(b))) {
25863  if (sizeof(Py_ssize_t) >= sizeof(long))
25864  return PyInt_AS_LONG(b);
25865  else
25866  return PyInt_AsSsize_t(x);
25867  }
25868 #endif
25869  if (likely(PyLong_CheckExact(b))) {
25870  #if CYTHON_USE_PYLONG_INTERNALS
25871  const digit* digits = ((PyLongObject*)b)->ob_digit;
25872  const Py_ssize_t size = Py_SIZE(b);
25873  if (likely(__Pyx_sst_abs(size) <= 1)) {
25874  ival = likely(size) ? digits[0] : 0;
25875  if (size == -1) ival = -ival;
25876  return ival;
25877  } else {
25878  switch (size) {
25879  case 2:
25880  if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
25881  return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
25882  }
25883  break;
25884  case -2:
25885  if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
25886  return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
25887  }
25888  break;
25889  case 3:
25890  if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
25891  return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
25892  }
25893  break;
25894  case -3:
25895  if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
25896  return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
25897  }
25898  break;
25899  case 4:
25900  if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
25901  return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
25902  }
25903  break;
25904  case -4:
25905  if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
25906  return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
25907  }
25908  break;
25909  }
25910  }
25911  #endif
25912  return PyLong_AsSsize_t(b);
25913  }
25914  x = PyNumber_Index(b);
25915  if (!x) return -1;
25916  ival = PyInt_AsSsize_t(x);
25917  Py_DECREF(x);
25918  return ival;
25919 }
25920 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
25921  return PyInt_FromSize_t(ival);
25922 }
25923 
25924 
25925 #endif /* Py_PYTHON_H */
#define PyMODINIT_FUNC